I'm trying to integrate Salesforce with Google apps in Apex. For this I need to do OAuth with google.

However, I'm confused with what value should be given for redirect_uri to google. I can create a vf page for receiving the OAuth callback, but this page needs to be public as the person doing OAuth won't be logged into Salesforce.

How to create a public page in Salesforce that can receive OAuth callback?


You should look into using Named Credentials with OAuth, then SF handles all that.

If you really want to do it yourself, create a Site and make the page visible to the Sites Guest User.

It's difficult to give a redirect_uri as this will be different on sandboxes and production (and it may change for My Domain, or an instance-split). You can do it, but you'll have to keep maintaining a list of all the possible varations

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.