If I put this link in my web browser (I put them on separate lines for readability):


and log in, it redirects me to the redirect_uri appended with a hash of all the important information I need. I want to use my own redirect_uri, so I modified the callback URL field for the application, and modified my request:


I can log in like I would in the previous example, and it redirects me correctly to my custom uri, but without the refresh token in the hash. Any ideas?

  • is there a subsequent redirect happening on your side? (eg HTTPS to HTTP, or stripping of WWW subdomain) – bigassforce Jan 23 '13 at 10:28

According to the docs:

The refresh token for the user-agent flow is only issued under one of the following circumstances:

User-agent flow is not intended for use with web apps (which is what it looks like you're trying to do). Use web server flow instead.

  • There is another undocumented case in which the refresh token is returned in user-agent flow, when the callback url uses the http protocol and the host is localhost. – xn. Dec 6 '13 at 22:04
  • Good call, @xn. - added http://localhost:port/ - thanks! – metadaddy Dec 9 '13 at 6:28
  • @metadaddy when I tried login.salesforce.com/services/oauth2/… &client_id=MY_ClientId &redirect_uri=localhost:8080 with MY_ClientId replaced with the consumer key and localhost:8080 as callback url in browser below error coming error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration what could be the possible reason? – Shebin Mathew Dec 9 '13 at 7:11
  • @ShebinMathew There is often some latency when changing redirect URI - see salesforce.stackexchange.com/a/12248/67 – metadaddy Dec 9 '13 at 20:35
  • @xn too bad it doesn't work when using a self-signed certificate locally on https (i.e. localhost) – contactmatt Jul 22 '14 at 23:50

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.