Hi all,
I’m attempting to use Banzai’s new REST connection functionality to connect to another Salesforce org. Is there a way to specify a URL parameter for an OAuth provider? Whenever I load the edit page that I’m working with, and the OAuth process begins for my model, the popup that comes up uses an incorrect redirect_uri parameter. Can this be overridden anywhere?
Thank you!
What redirect_uri is it setting? It should be getting set to a URL ending with /apex/skuid__oauthcallback or /apex/oauthcallback - is that not happening?
To connect to an external Salesforce org, you will need to setup a Connected App in one of your Salesforce orgs, and that Connected App will need to define Redirect URI’s according to the format documented in this tutorial: Connect to Dropbox data with REST Models, Step 1
Oh ok, I didn’t realize that SKUID had its own Callback URL. I made that change in my Connected App. It’s now set to the uri that the popup is trying to go to: https://skuid.csXX.visual.force.com/apex/oauthcallback.
After changing the callback URL, I was successfully authorized to the organization that I want to connect to. I got the login page and OAuth Allow/Cancel callback page from the popup.
Now I’m getting this error:
1. Error retrieving metadata for Model(s) associated with Data Source ‘Test’. Please check Models’ properties to ensure they are set correctly. Error connecting to REST Data Source at URL “https://na9.salesforce.com/services/data/v34.0/sobjects/Account/001E000000jLiQJSFH”: error
I’m wondering if there’s a property that I need to include for subsequent calls?
Is na9.salesforce.com the correct Salesforce org you’re trying to access, and is the Account record above the correct data you’re looking to retrieve?
Yes, na9 is the correct instance. Actually, I tried simply “/services/data/v34.0” as well and it gave me the same error.
I thought I might have to add an http header into the data source settings to force Salesforce to send JSON back:
“Accept: application/json”
But I got the same error.
Okay this is not as easy to do as it should be, but here’s the next step for debugging: open up the JavaScript console for your page and refresh the page. Go to the Network tab, and limit to just XHR requests. The last entry here, which should appear prior to the error message showing up in the page composer / runtime, should be to “apexremote”. Inspect this request, go to the “Response” panel, and copy whatever’s in there to a text editor so you can view it more easily. There may be some sort of error message embedded in here that sheds more light on what’s going on.
Thanks for the extra debugging advice, Zach!
It looks like I’m getting a 401 Unauthorized on the GET request to https://na9.salesforce.com/services/data/v34.0/sobjects. The response body is empty.
However, this is after the OAuth request goes through and I click “Allow”. I guess there must be another piece to the authorization step that I’m missing… do you have any ideas on what it might be?
Do you have time for a quick GoToMeeting?
If so, send an email to support at skuidify dot com and I’ll invite you to a GoToMeeting.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.