2

I've got a connected app that handles login through the Oauth 2.0 webserver flow, and was originally designed to run in the web browser outside of the salesforce ui. We still want it to be able to function separately, but we recently got a request to also add the app to the salesforce ui. Our idea was to use a url tab with a link to the app, but unfortunately requests for https://ap4.salesforce.com/setup/secur/RemoteAccessAuthorizationPage.apexp?source=... are sending a response back with a X-FRAME-OPTIONS:DENY header that is blocking the authorization page from being displayed in the salesforce ui.

Currently the connected app is set up so that users can self-authorize, and interestingly, we are only running into the problem when users attempt to first authorize the app through the salesforce ui. If a user has already previously hit allow through the stand-alone app, the redirect from https://login.salesforce.com/services/oauth2/authorize to https://ap4.salesforce.com/setup/secur/RemoteAccessAuthorizationPage.apexp?source= will return without an X-FRAME-OPTIONS header set.

I'm not sure why they didn't set the header to SAMEORIGIN, but I have a feeling that there's no way for us to change that.

Anyways, I guess my question is:

What's the easiest way to get an existing connected app displayed in the ui?

7
  • I never saw a connected App on UI. How does it look like? However it looks like the redirect URL is not matching.
    – Ashwani
    Commented Jan 18, 2017 at 4:35
  • @Ashwani I've updated my question, it isn't the redirect URL that's giving me trouble, it's the authorization page.
    – martin
    Commented Jan 18, 2017 at 4:57
  • Are you reaching to url like: ap4.salesforce.com/*definedRedirectURL*?code=aWxxxxxsade...c ?
    – Ashwani
    Commented Jan 18, 2017 at 5:07
  • @Ashwani The problem is that the salesforce page with the Allow and Deny buttons is being blocked by web browsers when the page is put in an iframe. Whereas the page returned from a request to the same host/path that just returns the javascript redirection to the redirect url is not blocked.
    – martin
    Commented Jan 18, 2017 at 5:20
  • That should be for obvious reason because first time user will have to go though login.salesforce.com. Once the app is approved it directly redirect to the org instance. With Iframe this won't work. I am just curious why iframe is needed.
    – Ashwani
    Commented Jan 18, 2017 at 5:23

2 Answers 2

1

I ended up going to Setup > Manage Apps > Connected Apps > MyApp > Edit Policies , and changed the app Permitted Users setting from All users may self-authorize to Admin approved users are pre-authorized, and then gave the permission to the connected app to the relevant users through profile permissions.

This was good enough for us, but I still haven't found a way to put a self-authorized connected app in a url tab, even though I feel like that's something that should be possible.

0

The URL Tab should not be accessed through intermediate url as given in question https://ap4.salesforce.com/setup/secur/RemoteAccessAuthorizationPage.apexp?source=...

It should be like:

https://login.salesforce.com/services/oauth2/authorize?respo‌​nse_type=code&client‌​_id=<your_client_id>‌​&redirect_uri=<your_‌​redirect_uri>

In case URL tab still doesn't work:-

The issue is URL tab open webpage in iframe so, the workaround should be:

  1. Create a visualforce page
  2. Create Visualforce Tab page for step 1 page
  3. Add the code to redirect the page to above url (in block) as soon as user hit the page. You can use action attribute on <apex:page/>

This would end the need of iframe and URL tab.

2
  • 1. The url in the url tab should be the url of the connected app, not a url in the middle of the oauth login flow. 2. I'm not trying to redirect the entire page to the connected app. I want it displayed in the ui.
    – martin
    Commented Jan 18, 2017 at 5:39
  • @martin Since the domain is changing iframe will not work for security reasons. As the URL is intermediate it wont provide much options like developer.salesforce.com/page/…
    – Ashwani
    Commented Jan 18, 2017 at 5:47

You must log in to answer this question.

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