I am working on an application, where any user can login into my application through Salesforce. As per mentioned in below url, We can use https://login.salesforce.com or for sandbox https://test.salesforce.com


For the authentication, and to get access token I am using https://login.salesforce.com but, if I also have an account on https://test.salesforce.com and try to login, It does not allow me as my account was registered on sandbox url, test salesforce. Now, Any type of user, We can have for the login through SalesForce, How can I achieve this thing ?

Thanks !


If you take any application getting authenticated using Oauth ,you will see an application is usually provided with two different buttons .One for Login Screen from Production and other for Login from Sandbox .

Most of applications also use selector to allow user to select whether user wants to login to Production or sandbox and then initiate login call .

Sample App that has two buttons for Login to Production and Login to Sandbox

enter image description here

Sample App that provides option to select Instance first

enter image description here

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.