I am a beginner in Angular JS and Salesforce.

I am building a hybrid application.

I am using the USER AGENT authentication flow

I used the following url :


I got the result as expected with the access token but did not get the refresh token.

Then i found this

The refresh token is only returned if the redirect URI is https://login.salesforce.com/services/oauth2/success or used with a custom protocol that is not HTTPS.

So I changed the redirect_uri in my url as :


I got the refresh token.

But then the page is stuck up at the below link


How do i make it redirect back to my app link


Thanks in advance.

2 Answers 2


I got the Answer.

I just changed the callback url in connected app settings to my app url and we have to use http instead of https.

  • 1
    Thanks for posting your solution. Please accept your answer as the solution to close your question.
    – Rob
    Oct 6, 2015 at 9:26
  • 1
    can you post the example url here? Jul 3, 2018 at 9:39

This only works because your redirect uri is a localhost. The redirect uri needs to satisfy these conditions:

enter image description here

http://localhost is also another condition that will allow the refresh_token to be passed back.

Reference Resource: https://help.salesforce.com/articleView?id=remoteaccess_oauth_user_agent_flow.htm&type=5

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.