function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amar SinghAmar Singh 

Unable to use Frontdoor.jsp to Log Into Salesforce

Hello,

I am using Frontdoor.jsp to Log Into Salesforce from one of the the Salesforce Organization(Source) to another Salesforce Organization (Target).

I have created one Connected App in Target Org with web scope.

Connected App

As per the documentation, we can use access_token from an OAuth authentication instead of Session ID.
https://help.salesforce.com/HTViewHelpDoc?id=security_frontdoorjsp.htm&language=en_US

I am unable to redirect to Target Organization with access_token from an OAuth instead of session ID.

targetURL: https://instance.salesforce.com/secur/frontdoor.jsp?sid=access_token&retURL=optional_relative_url_to_open

Thanks!!!
 
Daniel BallingerDaniel Ballinger
Have you also updated the subdomain in the targetUrl to match that used by the Org where the access_token/session_Id is valid?

E.g. https://na5.salesforce.com/secur/frontdoor.jsp?sid=access_token&retURL=optional_relative_url_to_open

Does the complete target URL with the correct domain and sid work if you use it outside of the connected app?

Are you getting any specific error messages?
Amar SinghAmar Singh
Thanks Daniel !!

1. I have added the domain in the targetURL to match the Target Org.

    E.g. https://amar-trailhead-dev-ed.my.salesforce.com/secur/frontdoor.jsp?sid=00D90000000xuMs!AQkAQOzOs6EodDkB7ufAv1qyemOqFoYXwpYacX6j1aKu0x5wf_JrIuaBRU1iyxU8ZLip9EgN1tE.AFJY_hqvo6s6nvk1cxOo&retURL=/06690000005ti4I

Domain settings

2. Yes, the complete target URL with the correct domain and sid works if I use Session ID (fetched from Developer Console -       
    UserInfo.getSessionId(); ) instead of access_token

3. I am not getting any specific error message,the redirected Page is asking for Username and Password instead of logging me in and even though    I provide the correct credentials its asking for the credentials again.
 
Marek SaktorMarek Saktor
I have the same issue, found another bunch of people with same issue, someone lists solution with SOAP https://developer.salesforce.com/forums/?id=906F0000000AqEGIA0 but that is cumbersome...

can someone from Salesforce comment on this?
SFDEV ThorSFDEV Thor
I ran in to similar problem. I was trying some Trailhead and was logged in to my Dev Org. I created my domain and deployed it to All Users.
Then I went to My Profile and updated some settings and my profile picture. It was done successfully bu when I tried to View, it suddenly redirected me to somewhere, and their I got this problem - This Site Can't Be Reached - https://<mydomain>-dev-ed.my.salesforce.com's server DNS address could not be found.

User-added image

When I tried to login salesforce redirected me to following URL:
https://mydomain-dev-ed.my.salesforce.com/secur/frontdoor.jsp?sid=00D9000000105NT%21AQ0AQIlWEAe0EQQbGanhH3VA77ij41P1wHBSKELP3VrQnPS5eIGt5jN8vconV05Jz5cXMieJgUFdi7.Y_9_8VNTDRxmdYFsk&apv=1&allp=1&cshc=0000003c7Rf000000105NT&display=page

And showed same error - DNS address could not be found.

My solution was - I removed all other query params except "sid" (Its access token)
My URL became:
https://mydomain-dev-ed.my.salesforce.com/secur/frontdoor.jsp?sid=00D9000000105NT%21AQ0AQIlWEAe0EQQbGanhH3VA77ij41P1wHBSKELP3VrQnPS5eIGt5jN8vconV05Jz5cXMieJgUFdi7.Y_9_8VNTDRxmdYFsk

I dont know  how it worked, But my logic was simple.
1 - After login - frontdoor.jsp - It was may be trying to redirect to my old page.
2 - Somehow due to some bug from Salesforce, that page was inaccessible and it was giving that DNS error.
3 - I just thought, let the page just login and not to redirect to somewhere with some other query params trying to set some enviornment settings etc.
4 - And then with above stripped URL, I was able to login successfully to my dev org.

Thats it - Hope anyone finds it similar and helpful.

Thanks !




 
Marcel Peixoto 4Marcel Peixoto 4

I have the same issue and spent two days trying to figure out the issue. I solved changing the login from REST API to SOAP API and it worked fine.

 

Soap API XML Example
 

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
   <n1:login xmlns:n1="urn:enterprise.soap.sforce.com">
    <n1:username>user@domain.com</n1:username>
    <n1:password>pwd+SecurityToken</n1:password>
   </n1:login>
</env:Body>
</env:Envelope>
URL: https://login.salesforce.com/services/Soap/c/24.0/
Also,  in the Header of SOAP I have added Content-Type = text/xml and SOAPAction = login