4

I'm using this:

https://login.salesforce.com/services/oauth2/authorize?response_type=token&client_id=3MVG99qusVZJwhsnpw0Ov62MLLZLjNIZatabRXwIxuPnXlOwwS2tHJuZ_D1LcGuOpo5ZfFn6POz_re1f2iUQU&redirect_uri=https://login.salesforce.com/services/oauth2/success

Which gets redirected to (upon success):

https://login.salesforce.com/services/oauth2/success#access_token=ACTUALTOKENREMOVED&instance_url=https%3A%2F%2Findeni.my.salesforce.com&id=https%3A%2F%2Flogin.salesforce.com%2Fid%2F00Db0000000IC0yEAG%2F005b0000000hBMsAAM&issued_at=1433271628862&signature=1Il90AbUNRIy4%2Bfewvb5f7A%2Fahe0PSDJ%2BhS%2B8g53XqI%3D&scope=api&token_type=Bearer

As you can see, the redirected URL doesn't contain the refresh_token specified here: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_web_server_oauth_flow.htm

What am I missing?

4
  • 1
    Have you configured this in Salesforce using Connected apps? Jun 2 '15 at 19:49
  • In the connected app it shows Refresh Token Policy: Immediately expire refresh token. The problem is, it's not showing any other option.
    – yi1
    Jun 3 '15 at 12:58
  • Found this salesforce.stackexchange.com/questions/69161/… - which solved my problem. Thanks @heisenberg (I wish they documented this!)
    – yi1
    Jun 3 '15 at 13:01
  • Great.. enjoy... Jun 3 '15 at 13:03
4

I think you need to specify the scope, like this:

https://na16.salesforce.com/services/oauth2/authorize?response_type=token&client_id=[your_client_id]&redirect_uri=https://login.salesforce.com/services/oauth2/success&display=touch&scope=full refresh_token

Specifically, this:

scope=full refresh_token

(This is what I use, and it works)

5
  • How is scope=full refresh_token a valid URL? It has a space in it?
    – Micah
    Jul 6 '18 at 20:09
  • This is a while a ago... add an underscore, it could be a typo... either that or a + Jul 6 '18 at 22:24
  • Yep, looks like a typo. %20 or + works fine.
    – Micah
    Jul 11 '18 at 22:14
  • 1
    this "full" is misleading
    – Theo
    Feb 11 '19 at 13:34
  • 1
    Yup, it sure is... I forget if you can write it like scope=full+refresh_token ... possibly? Feb 11 '19 at 18:44

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.