# OAuth2 connection only working for 20 minutes

**URL:** <https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272>\
**Category:** Support\
**Created:** [November 26, 2020, 7:46am UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272 "2020-11-26T07:46:02Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![hende](https://community.easymorph.com/letter_avatar_proxy/v4/letter/h/aca169/32.png) [@hende](https://community.easymorph.com/u/hende)\
**Post date:** [November 26, 2020, 7:46am UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/1 "2020-11-26T07:46:02Z")

</div>

Hi,

I am very pleased with the OAUTH2 feature of EasyMorph, but there is an annoyning thing with it:

I can make a connection with my application (exact online) and after the initial access token received at the authorisation expires a new access token is acquired and used by Easymorph, but when that access token expires the next refresh request fails with an error: {"error":"unauthorized\_client","error\_description":"Old refresh token used."}. I have to re-authorize to get the connection working again.

Any idea how to fix this or is it a bug ?

Kind regards,

Harm van het Ende

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [November 26, 2020, 9:38am UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/2 "2020-11-26T09:38:52Z")

</div>

Hi Harm and welcome to the Community!

The OAuth2 connector in EasyMorph has a limited functionality because at this point connectors in EasyMorph are immutable (i.e. read-only). Therefore, the connector only works well with services that don't expire their refresh tokens at all (e.g. Google), or expire them once in a few months (e.g. Microsoft). If a service expires refresh tokens quickly, as it seems to be the case with Exact Online, the connector won't be able to update the refresh token stored in the connector settings and therefore will expire and require re-authorization.

All in all, It's a known issue which will be addressed next year with the introduction of global mutable key-value storage in EasyMorph.

---

<div class="post-metadata">

**Author:** ![hende](https://community.easymorph.com/letter_avatar_proxy/v4/letter/h/aca169/32.png) [@hende](https://community.easymorph.com/u/hende)\
**Post date:** [November 26, 2020, 12:18pm UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/3 "2020-11-26T12:18:19Z")

</div>

Hi Dmitry,

Thanks for the prompt response. Do you have an estimate timeframe when the global mutable key-value storage will be available ?

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [November 26, 2020, 1:04pm UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/4 "2020-11-26T13:04:24Z")

</div>

It's currently planned for 2021-Q2.

---

<div class="post-metadata">

**Author:** ![roberto](https://community.easymorph.com/user_avatar/community.easymorph.com/roberto/32/8595_2.png) [@roberto](https://community.easymorph.com/u/roberto)\
**Post date:** [January 6, 2021, 11:06am UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/5 "2021-01-06T11:06:21Z")

</div>

Hello!

I'm in the same situation, it's good to know it's on the roadmap 🙂

Regards,

Roberto

---

<div class="post-metadata">

**Author:** ![hende](https://community.easymorph.com/letter_avatar_proxy/v4/letter/h/aca169/32.png) [@hende](https://community.easymorph.com/u/hende)\
**Post date:** [January 6, 2021, 11:27am UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/6 "2021-01-06T11:27:09Z")

</div>

Hi Roberto,

Are you using Exact Online also ?  
If that's the case which redirect url do you use. I am using the postman callback url, but it stopped working with an unauthorized client error message.

---

<div class="post-metadata">

**Author:** ![roberto](https://community.easymorph.com/user_avatar/community.easymorph.com/roberto/32/8595_2.png) [@roberto](https://community.easymorph.com/u/roberto)\
**Post date:** [January 6, 2021, 11:38am UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/7 "2021-01-06T11:38:46Z")

</div>

Hello Harm,

No, I'm using Salesforce. But you receive the "unauthorized client" error because the token has expired, right?

@dgudkov, while this is in development, is it possible to create OAuth2 + the refresh token procedure through different EasyMorph "Web Requests" actions? So setting the basic OAuth2 procedure first, and when a "session\_expired" message is received from the API, then execute a certain set of actions that will obtain the refresh token and will resume the connection.

Thanks,

Roberto

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [January 7, 2021, 11:54am UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/8 "2021-01-07T11:54:45Z")

</div>

This is technically possible, but it would be very _very_ non-trivial. I would suggest to wait until we have it added to EasyMorph. Meanwhile, you can try using 3rd party services to pull data from Salesforce into Google Drive or Amazon S3, and then using EasyMorph to process it further.

---

<div class="post-metadata">

**Author:** ![roberto](https://community.easymorph.com/user_avatar/community.easymorph.com/roberto/32/8595_2.png) [@roberto](https://community.easymorph.com/u/roberto)\
**Post date:** [April 30, 2021, 8:41am UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/9 "2021-04-30T08:41:54Z")

</div>

Hello,

I've noticed that after a month without accessing a certain API, I don't have to re-authorize again, the connection is still succeeding. Has something changed since January 2021 in the way you manage Oauth2, so that now I don't have to re-authorize?

Thanks,

Roberto

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [April 30, 2021, 12:57pm UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/10 "2021-04-30T12:57:46Z")

</div>

We did a few minor improvements, but OAuth tokens are still static and don't refresh automatically.

---

<div class="post-metadata">

**Author:** ![roberto](https://community.easymorph.com/user_avatar/community.easymorph.com/roberto/32/8595_2.png) [@roberto](https://community.easymorph.com/u/roberto)\
**Post date:** [April 30, 2021, 3:51pm UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/11 "2021-04-30T15:51:15Z")

</div>

Ok. It's strange because now I don't have to re-authorize any more in Salesforce (the settings in Salesforce haven't changed). Can I know what changes you did?

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [April 30, 2021, 8:41pm UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/12 "2021-04-30T20:41:56Z")

</div>

Roberto, those were really small technicalities. Can't remember what exactly.

---

<div class="post-metadata">

**Author:** ![roberto](https://community.easymorph.com/user_avatar/community.easymorph.com/roberto/32/8595_2.png) [@roberto](https://community.easymorph.com/u/roberto)\
**Post date:** [May 3, 2021, 7:01am UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/13 "2021-05-03T07:01:58Z")

</div>

Ok, understood. Is the global mutable key-value storage still in the roadmap for 2021-Q2?

Thanks!

Roberto

---

<div class="post-metadata">

**Author:** ![hende](https://community.easymorph.com/letter_avatar_proxy/v4/letter/h/aca169/32.png) [@hende](https://community.easymorph.com/u/hende)\
**Post date:** [May 3, 2021, 7:19am UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/14 "2021-05-03T07:19:40Z")

</div>

Hello Roberto,Dmitri,

I just tested my connection to Exact Online. It is still the same as before (as expected).

Kind regards,

Harm van het Ende

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [May 3, 2021, 6:00pm UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/15 "2021-05-03T18:00:49Z")

</div>

Yes, it's on the roadmap. Probably in July.

---

<div class="post-metadata">

**Author:** ![roberto](https://community.easymorph.com/user_avatar/community.easymorph.com/roberto/32/8595_2.png) [@roberto](https://community.easymorph.com/u/roberto)\
**Post date:** [July 30, 2021, 7:07am UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/16 "2021-07-30T07:07:37Z")

</div>

Hello,

Will this issue be solved with "Shared memory"?

> [@Preview: Shared memory](https://community.easymorph.com/t/preview-shared-memory/2892):
>
> In version 5 we will be introducing a new supporting data service - shared memory. From a technical standpoint, the shared memory is centralized key-value storage that is physically located in the same repository where data connectors are stored. If you're not familiar with the concept of key-value storage, you can think of it as a Windows registry where values are stored by a certain path (key). At this point, there are 4 operations that can be done with the shared memory: Remember Recall …

Thanks,

Roberto

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [July 30, 2021, 9:01am UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/17 "2021-07-30T09:01:44Z")

</div>

Yes, in v5 OAuth refresh tokens will update automatically using a mechanism similar to "Shared memory". This will resolve the problem with short-living OAuth connections.

By the way, a beta version is already available. Send me a DM if you would like to test OAuth and/or Shared memory.

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [October 15, 2021, 11:27pm UTC](https://community.easymorph.com/t/oauth2-connection-only-working-for-20-minutes/2272/19 "2021-10-15T23:27:19Z")

</div>

In version 5.0 OAuth tokens now update/refresh automatically. EasyMorph can now handle connections to cloud apps with OAuth with very short-living tokens.
