About EasyMorph Tutorials & Examples Web-help

OAuth2 connection only working for 20 minutes

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

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.

Hi Dmitry,

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

It’s currently planned for 2021-Q2.

Hello!

I’m in the same situation, it’s good to know it’s on the roadmap :slight_smile:

Regards,

Roberto

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.

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

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.

To learn more about EasyMorph visit easymorph.com.