09-13-2017 08:27 AM
Hi,
Is anyone using REST Get snap with Salesforce instance using OAUTH2 account? I am having trouble with keeping my Account tokens up to date. I am able to connect and receive an Access Token and a Refresh Token on my account using the Account “Refresh” button. But SF does not provide me back a “Access token expiration” time. Apparently per SnapLogic support, I cannot enable “auto refresh token” on the account so the token can refresh without an expiration date on the token. I have to manually every hour open my account settings in Snaplogic account and hit “Refresh” to receive a new refresh and access tokens. If not, my snap step returns error “Session expired or invalid”,“errorCode”:“INVALID_SESSION_ID” in all of my pipelines. It’s very frustrating and redundant having to do this multiple times a day.
Is there a way to pass thru a expiration token time to the account? Or is there a way I can force a token refresh each time my pipeline runs without my input?
My use case is, SF snaps do not give us ability to access rich functionality such as getdeleted() or getupdated() on SF objects. These logs contain hard deleted items per object (when the object is replicated in SF) and we use these logs to keep the data in synch in our DB without having to re-download hundreds of millions of records per object every hour which is not possible. This log data is not accessible through SOQL as far as I can see and they are not in the recycle bin (hence hard deleted) so standard snaps don’t work for this.
Example of REST Get service url for hard deleted item logs:
https://instance#.salesforce.com/services/data/v39.0/sobjects/AccountTeamMember/deleted/?start=2017-...
SF documentation: Developer SF REST API - GetDeleted()
Another way of getting these results from what I have read is to use REST API QueryAll() functionality in SF. But it uses same Account configuration.
Any help of feedback is much appreciated.
01-18-2019 03:20 PM
Any thoughts on securing those credentials better if they’re not in an actual “account”?
01-22-2019 08:21 AM
Thanks @lzapart for helping. Those who are struggling in getting refresh_token from SalesForce, make sure the connected app in SalesForce has Selected OAuth Scopes as follwoing:
Full access (full)
Perform requests on your behalf at any time (refresh_token, offline_access)
Then using postman make a request to get new access_token with your client_id and client secret with scope as refresh_token:
Use that refresh_token in pipeline shared by @lzapart along with client_id and client secret to get access_token.
04-14-2021 01:18 AM
Thanks @bhupender.singh for your input, which was still helpful to me even after a year. 🙂
I was facing the same issue in Oauth2 Account, as it wasn’t auto-refreshing the token for me, and I was reluctant on taking the whole REST POST Snap approach.
In SFDC App, I had only Selected OAuth Scopes as “Full access (full)”, now I tried selecting both:
and generated the Client ID and Client Secret which I then used in the Snaplogic Oauth2 account. It works for me now! 🙂
Will keep posted on any other observations. Thanks again!
11-10-2022 01:06 AM
Hi, Could you please let us know what have you given in callback url at salesforce end. We are getting the below error while clicking on “authorize” in snaplogic salesforce oauth2 account.
error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration
11-10-2022 02:43 AM
HI @KTsnap,
I believe you need to add the Snaplogic redirect uri:
https://elastic.snaplogic.com/api/1/rest/admin/oauth2callback/rest