Forum Discussion
Hi,
Yes, the issue still exists for me. I already talked with support but did not get any solution to this issue and I was wondering if anyone else has issues using the “auto refresh” Salesforce token for a OAUTH2 account in SnapLogic. Support tells me I cannot auto refresh an account token without a token expiration date on the account so I’m stuck.
Hi Izapart,
I came to the same requirement where i need to get access_token and refresh_token from Salesforce using the OAuth 2. I am able to get access_token value and access_token_expiration shows as -1, which i am assuming that access_token never expires. But i am not able to get the refresh_token.
How you had configured the Salesforce account in order to get the refresh_token in your case.
Any help is appreciated.
Thanks
- lzapart7 years agoNew Contributor III
Hi, actually in my SF instance the refresh token does expire but can be refershed using refresh token request. I use a REST POST snap each time I want to access
the SF API to refresh my token first just in case if it expires, using the grant type refresh_token.To receive a refresh token, follow these steps documented here:
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_oauth_endpoints.htmBasically you need to first receive the authorization code. Then use it to request a refresh token using the “/token” url request.
In SnapLogic, before each of my API calls I refresh the token first using this in REST Post Snap service URL configured like here:
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_refresh_token_oauth.htm using refresh_token grant type.It’s sad that we can’t create a SnapLogic Account for Salesforce API because the token does not have an expiration date (mandatory per SnapLogic). That would
have made this a lot easier and the tokens would refresh automoatically if selected to do so on the SL account. That is why I have to refresh the token manually in each of my pipelines as step 1 by using the REST POST snap and calling the /token url to refresh
it, then pass the token to my REST GET snap to be used in the header to get my data out of SF.- bhupender_singh7 years agoNew Contributor III
@lzapart could you please share your pipeline.slp for the workaround solution.Similar to what you had described, I have to go in account settings and click on authorize and apply for this to work.
- lzapart7 years agoNew Contributor III
Hi. Don’t use the “Account” because it does not work for the API account for SF, it won’t let you auto refresh the token because no expiration date so it’s useless.
This is the workaround.You need to get authorization from your Salesforce server and copy the “refresh token” that you receive. Then in the SnapLogic pipeline add a REST POST snap,
and for service url in the snap provide the following server url: https://login.salesforce.com/services/oauth2/token?grant_type=refresh_token&client_id=abc1&client_secret=abc2&refresh_token=abc3Provide the correct clientid, secret, and refresh token in the url and the rest post snap will generate a grant authorization for you. Since the refresh token
does not expire, you can use this snap since it won’t expire in any job. I’ve attached a sample pipeline for reference. No account should be associated with the REST snaps for this.SFDC_Auth_Sample_API_2019_01_18.slp (7.54 KB)