3

So I created a new Connected App in Salesforce - in a sandbox environment. In the app's settings I enabled OAuth with Full access and set the Callback URI to https://test.mydomain.com/tools/account_history.php

This was about a week ago, so I know that the Callback URI has had plenty of time to fully propagate. However, if I try loading the auth URL it returns this error every time:

error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration

These are the auth URLs I have been trying:

https://test.salesforce.com/services/oauth2/authorize?response_type=code&client_id=MYCLIENTID&redirect_URI=https%3A%2F%2Ftest.mydomain.com%2Ftools%2Faccount_history.php

https://login.salesforce.com/services/oauth2/authorize?response_type=code&client_id=MYCLIENTID&redirect_URI=https%3A%2F%2Ftest.mydomain.com%2Ftools%2Faccount_history.php

https://test.salesforce.com/services/oauth2/authorize?response_type=code&client_id=MYCLIENTID&redirect_URI=https://test.mydomain.com/tools/account_history.php

https://login.salesforce.com/services/oauth2/authorize?response_type=code&client_id=MYCLIENTID&redirect_URI=https://test.mydomain.com/tools/account_history.php

Is there perhaps an entirely different auth URL to use for sandboxed environments? The error seems misleading since the URI I'm sending in my auth request does precisely match my configuration.

3

If your sandbox has My Domain enabled, replace test.salesforce.com with your domain and try again.

| improve this answer | |
  • Thank you, I didn't even know about My Domain! It was enabled although Prevent login from https://test.salesforce.com was unchecked. At any rate, I just tried using the My Domain setting https://mydomain--Full.cs47.my.salesforce.com but receive the same result. I thought for sure this was the issue. I'll keep trying. – Typel Sep 25 '19 at 19:30
  • which OAuth flow are you trying to use? I noticed you are not passing the client secret. – CommonCoreTawan Sep 25 '19 at 19:55
  • Authorization Code Grant: tools.ietf.org/html/rfc6749#section-4.1 – Typel Sep 25 '19 at 20:02
  • Got it! So I had been using an example URL structure from one of the countless outdated examples floating out there on the web. The particular example I had borrowed from set the URL as &redirect_URI= but apparently this is case sensitive and needs to be &redirect_uri= . Thanks so much for your help, not using the My Domain setting was also a big part of the problem! – Typel Sep 25 '19 at 20:13
  • 1
    URLs are not case sensitive. Only parameters could be case sensitive if not handled properly while fetching them - either parameter name or value - which looks like it with this particular case – salesforce-sas Sep 26 '19 at 2:40

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.