Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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
up vote 6 down vote accepted

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.

share|improve this answer
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… &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%20conf‌​iguration 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 – 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 posting your answer, you agree to the privacy policy and terms of service.

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