1

I am trying to learn OAuth flow and managed to complete an OAuth flow where Salesforce is the Auth provider as well as the Resource provider following this article from Jeff Douglas

Now I want to understand another scenario of the flow where Auth. Provider is Google. I was following step by step instructions from this SF help article. I have created the Google Auth Provider from Setup > Auth. Providers, added the Consumer Key and Secret from my Google App, and updated the Google App with the callback URL generated by Salesforce for this Auth. Provider.

Then I log out of all active SF sessions and Google sessions of my browser, and hit the Test only initialization URL (something like https://login.salesforce.com/services/auth/test/00D1I000001fgDlUAI/MyOAuthProv) . I am redirected to Google sign-in page as expected. I log in successfully. I am also being redirected to Salesforce. But now instead of being provided with an authorization screen, all I have is an XML:

<user>
<full_name>My Google Name</full_name>
<provider>Google</provider>
<org_id>my org id</org_id>
....
<portal_id>000000000000000</portal_id>
<locale>en-GB</locale>
<email>mygmail@gmail.com</email>
</user>

I never get any Authorization screen and I cannot access any SF page.

The header at the top says "Forwarding" and URL is:

https://mydevorg.my.salesforce.com/services/authcallback//?state=something&authuser=0&session_state=something&prompt=none#

Has any one got to get this flow working? I would be greatly obliged to know what I am missing.

2

This is the intended behavior of the "Test-only" URL - it shows you the user attributes returned by the Auth Provider, which helps with writing/debugging the Registration Handler.

For an actual Sign-In, you have to use the "Single Sign-On Initialization URL" (.../services/auth/sso/AuthProv). This should redirect you back to Salesforce with a signed-in user.

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.