2

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!

3 Answers 3

2
+50

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

0

I had similar requirement and here is what i ended up doing.

1) We used SOAP API and gave login call. 2) Login API returned the HOST URL and Session ID. 3) Using HOST URL and Session ID create new URL like:

'https://'. $url['host'].'/secur/frontdoor.jsp?sid='. $mylogin->sessionId .'&retURL=https://c.ap2.visual.force.com/apex/Inline_page'

4) Note the retURL parameter which tell SFDC to land on that perticuler page 5) Then redirect user to URL generated in step 3

I doubt that this will not work with connected app as you cannot use the token as session id(Not sure though)

But this certainly works with SOAP API.

0

https://'. $url['host'].'/secur/frontdoor.jsp?sid='.$mylogin->sessionId .'&retURL=https://c.ap2.visual.force.com/apex/Inline_page

This technique WILL work with the access_token returned from a connected app as log as it is scoped for visualforce or full.

1
  • Can you add more detail here?
    – Adrian Larson
    Nov 7, 2016 at 16:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .