[SalesForce] Connected App OAuth show VisualForce Page

Is it possible to share a VisualForce page through a connected app? I have 2 Salesforce orgs, and my users on one org would like to have access to some of the VisualForce pages on another.

I see that one of the OAuth Scopes is labeled "Provide access to custom applications (visualforce)", which leads me to believe that I could display a VisualForce page in another org. I'm able to authenticate, but I'm a little lost when it comes to displaying a VisualForce page. I'm assuming I need to use my access_token in some way, but where that is isn't obvious to me at this point.

Any direction would be helpful. Thank you!

Best Answer

This page describes the functionality. As it stands right now your question is a bit broad as you have not shown any code so hopefully this will get you to where you need to be:

For example, if you were using the OAuth User-Agent flow, you can append ‘&scope=visualforce’ to the end of the OAuth authorization URL (i.e. the URL that you would redirect users to would look something like ‘https://login.salesforce.com/services/oauth2/authorize?response_type=token&client_id=&redirect_uri=&scope=visualforce’). Once the user logs in successfully, you can then append the OAuth access token to a VF URL and direct users to it (for e.g. ‘https://c.cs0.visual.force.com/apex/HelloWorld?oauth_token=’).

Using OAuth 2.0 with Visualforce in Winter ’12

Identity URLs are return as part of the token response so you can get the pod, protocol, and host from it:

Identity URLs

Related Topic