Error connecting to external salesforce org

  • 2
  • Problem
  • Updated 1 year ago
  • Solved
error: redirect uri mismatch

I set up connections to external salesforce orgs per the documentation.

Now, when I try to create a model against one of those data sources, I get this popup error:

Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 2 years ago

  • 2
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
What Callback URLs did you use when defining your Connected App in Salesforce? If you look in the URL for the popup that's being launched, there should be a "redirect_uri" query string parameter where you can see the redirect URI / callback URL that you need to have whitelisted in your Salesforce Connected App --- if it's not there, you're going to get the redirect_uri_mismatch error as you're seeing currently.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Thanks, Zach.

I had my connected app set up with the original instructions from skuid-grunt, which had us set the callback url to something like localhost:3000.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Ok, I've got the redirect_uri sorted.

Now I'm getting this error in the auth popup:
error=invalid_scope&error_description=the+requested+scope+is+not+allowed

The connected app scope:


The authentication source details:


What am I missing here?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Hey Zach. I'm running into the redirect uri mismatch error again.

Here's the redirect_uri parameter in the popup query string:

redirect_uri=https%3A%2F%2Fskuid.na3.visual.force.com%2Fapex%2Fskuid__oauthcallback

And I have https://skuid.na3.visual.force.com/apex/skuid__oauthcallback whitelisted in the custom app (as well as https://skuid.na3.visual.force.com/apex/oauthcallback). What could I be missing?

Thanks!
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
Matt, did you ever get this resolved? I've fixed the redirect uri mismatch error, by including https://c.cs60.visual.force.com/apex/skuid__oauthcallback as well as https://skuid.cs60.visual.force.com/apex/skuid__oauthcallback, and things work when I preview the skuid page and am viewing the page from within the skuid namespace. However, once I go live with the page on a visual force page to display to end users, I get a popup that says "You have been successfully authenticated! This window should close momentarily..." but the window never closes, and when I do close the window, there's an error on the skuid page that says "Login cancelled."
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
@Matt and @Jack:

To resolve the Redirect URI mismatch error when you're connecting to external Data Sources using Skuid from the "c" namespace, which will happen when you're displaying Skuid using the Component method of overriding, you need to specify a "Custom Callback URL" in the Auth Provider settings. This capability is only available as of the Brooklyn Q2 Point Release.

1. CLONE the "oauthcallback" visualforce page that's included in the Skuid package into your local list of VF pages. Basically, go into Developer Console, click "Open" > "Pages", and search for "oauthcallback". Open this. Copy everything in the file, and paste it into a brand-new Visualforce Page. Then, for the two Static Resource loads, replace "$Resource." with "$Resource.skuid__" - that should save successfully.



2. In your Skuid Auth Provider's "OAuth Configuration", set Custom Callback URL to "/apex/oauthcallback".




3. In your Salesforce Connected App's list of Callback URLs, make sure that you add a Callback URL that contains your "--c" domain, e.g. 

https://womensfirstchoice--c.na3.visual.force.com/apex/oauthcallback


That should do it.
(Edited)