How to login to salesforce using session id?

Webner Solutions
2 min readFeb 25, 2022

--

How to login to salesforce using session id?
How to login to salesforce using session id?

We may also access Salesforce without having to enter a username and password. We may log into Salesforce using the session ID.

To log in to salesforce using session-id follow the following steps:

Step 1: execute this piece of code in the “Anonymous window” of the developer console

String sessionID=UserInfo.getOrganizationId()+''+UserInfo.getSessionId().subString(15);
system.debug('session id '+sessionID);

After this, you will get the sessionId now copy the sessionId

Step 2: in the below URL paste the copied sessionId instead of
https://<endpoint host>/secur/frontdoor.jsp?sid=<session id>”
Example:
https://<endpoint
host>/secur/frontdoor.jsp?sid=00D5g000002y3kOEAQ!AQQAQBr4DvyIIXPQ179oLbO2YbSNVaM5gwogGUEjH3KySqiB5d_9AMmnBwIKhOeekpm5hrXAawl573k4gfQ8mxlD1rb03xoO

Step 3:- in below URL paste the login URL instead of <endpoint host>
https://<endpoint host>/secur/frontdoor.jsp?sid=<session id>”

Copy the highlighted link and paste it instead of “<endpoint host>”

Example: https://webnersolutionsprivatelimi2-dev-ed.my.salesforce.com//secur/frontdoor.jsp?sid=00D5g000002y3kOEAQ!AQQAQBr4DvyIIXPQ179oLbO2YbSNVaM5gwogGUEjH3KySqiB5d_9AMmnBwIKhOeekpm5hrXAawl573k4gfQ8mxlD1rb03xoO

Now using this URL you can login to salesforce in any other system without using a username and password

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Originally published at https://blog.webnersolutions.com on February 25, 2022.

--

--

Webner Solutions

Our team in Salesforce is very strong, with in-depth knowledge of Salesforce classic and Lightning development as well as the Service cloud.