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) Jan 23, 2013 at 10:28

1 Answer 1


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, 2013 at 22:04
  • Good call, @xn. - added http://localhost:port/ - thanks!
    – metadaddy
    Dec 9, 2013 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? Dec 9, 2013 at 7:11
  • @ShebinMathew There is often some latency when changing redirect URI - see salesforce.stackexchange.com/a/12248/67
    – metadaddy
    Dec 9, 2013 at 20:35
  • @xn too bad it doesn't work when using a self-signed certificate locally on https (i.e. localhost) Jul 22, 2014 at 23:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .