0

3rd Party app needs to access Salesforce resources without user interaction. I am trying to use OAuth refresh token - Refresh token . I generated an access token and a refresh token using postman and I subsequently use the above generated refresh token to get a new access token like hitting url- https://test.salesforce.com/services/oauth2/token?grant_type=refresh_token&client_id={Client Id Value from connected app}&client_secret={Client Secret value from Connected app} &refresh_token={refresh token value} This returns the response as

<OAuth> 
   <access_token>          00DQ000000GKmTTAQUAQKncOXXXXXXXXXXXXXXXXXXXXXXXXXXX9M55Ilp.kiXvgigce_we1Vv5m298ZThgKLZBbPF50CG7S30laMc 
   </access_token> 
   <signature>
      Z5GzLKXe4ys5XXXXXXXXKGq+4RI8ulpmdrVs=
   </signature> 
   <scope>
      refresh_token
    </scope> 
   <instance_url>
      https://MYInstanceUrl.salesforce.com
   </instance_url> 
    <id> 
      https://test.salesforce.com/id/00DQ000000TYmTMA1/{My Salesforce User id} 
    </id> 
    <token_type>
      Bearer
    </token_type> 
    <issued_at>
      1561380351195
    </issued_at> 
  </OAuth>

Now I use https://MyInstanceURL.salesforce.com/services/apexrest/bulkrequest with authorization as: OAuth {Access token} , it gives 401 error. Even with the postman I get the same error. I checked all the configurations in the connected app, it looks fine. Scope in the connected app has all the relevant values. What I am missing? Can it be related to my salesforce user access to the connected app? My profile has 'API enabled' permission. Also, when requesting new access token using refresh token, what is the significance of the Salesforce User Id returned in the response along with the org id?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.