Salesforce Login

How to login in Salesforce? There are different ways to login into Salesforce. You can login into using production URL, Sandbox URL, Custom Domain, Single Sign-on, Lightning login and Login Flows In Salesforce. Let see how all Login option works. Let see the ultimate guide for Salesforce login.

Salesforce Login URL

What is the Salesforce login URL? The login URL allows you to access your CRM System. There are different URLs to login into Salesforce production, Sandbox, or custom domain.

  1. Production: You can use the below Salesforce login url to access the Salesforce production or Developer org. URL: https://login.salesforce.com/.
  2. Sandbox: Let see how to login to Salesforce Sandbox. Use below URL http://test.salesforce.com/.
  3. Custom: If custom domain is enable in your org then you need to get custom domain url from My Domain setting.

If you have any trouble logging in, you can click on the “Forgot Your Password?” link on the login page to reset your password.

How to login Using Custom Domain

Let’s see how to log in to Salesforce using a custom domain. Here is step by step process to log in using a custom domain.

  1. Directly enter the custom URL in browser
  2. Open login URL then select the Use Custom Domain Option.
How to login Using Custom Domain

Then enter the custom domain name like below. So it will create login url for a custom domain.

Then click on continue and enter your username and password to login.

Salesforce Login Parameter

Sometimes, you need to login into Salesforce using another organization (Not SSO). For that, you need to pass a parameter to log in. In that case use can pass below param to access Salesforce.

  • un: un used for username
  • pw: pw used for password
  • startURL: If you can to access a particular URL

for example

https://www.salesforce.com/[email protected]&pw=mypassword

This is not a secure way to login as username and password will come in URL.

Single Sign-On (SSO) for Salesforce login

Single sign-on (SSO) is an authentication method that enables users to access multiple applications with one login and one set of credentials. This is also called as Identity Flows. Lean SSO with Single Sign on Between Two Salesforce Org.

How To Implement Single Sign-On In Salesforce

There are three mechanisms that can be used to achieve this in Salesforce.

  1. Delegated authentication
  2. Federated Authentication
  3. OpenID Connect

Check the steps and considerations for the following single sign mechanisms:

Also learn about Social Sign on in Salesforce.

Setup Okta Single Sign-On (SSO) with Salesforce

Check How to Setup Okta Single Sign-On (SSO) with Salesforce. Okta connects any person with any application on any device. Okta enables you to provide Single Sign On (SSO) access to cloud, on-premises, and mobile applications. You sign into Okta and you can then launch any of your web apps without having to re-enter your credentials.

Using Single Sign-on Setting you can disable login with salesforce credentials.

Login into Salesforce using SFDX

You can login into Salesforce using SFDX commend to Authenticate the user using SalesforceDX command.

1. Authorize an Org Using the Web Server Flow

Use below command to login.

sfdx auth:web:login --setdefaultdevhubusername --setalias my-hub-org

Optionally you can create connected app if you are required more security and control.

2. Authorize an Org Using the JWT Bearer Flow

OAuth 2.0 JWT Bearer flow is used for server to server integration scenarios. This flow uses a certificate to sign the JWT request and doesn’t require explicit user interaction. Learn how to implement Salesforce OAuth 2.0 JWT Bearer flow.

Run the auth:jwt:grant CLI command

sfdx auth:jwt:grant --clientid 04580y4051234051 \
--jwtkeyfile /Users/jdoe/JWT/server.key --username [email protected] \
--setdefaultdevhubusername --setalias my-hub-org

3. Connect With Your Salesforce Org Using VS Code.

Visual Studio Code is recommended IDE for Salesforce development. Check out how to setup VsCode for Salesforce and Connect with Salesforce Using “SFDX: Authorize an Org“ command.

Salesforce login using curl

If you are working on REST api and you need to connect with Salesforce then you can CURL to Authenticate to Salesforce. cURL is open source command line library mostly used to test http request.

Follow below Step to Authenticate into Salesforce using CURL

  • Create Connected App and copy consumer key and consumer secret.
  • Use below command
curl https://login.salesforce.com/services/oauth2/token -d 'grant_type=password&client_id=***consumer_key*******&client_secret=****consumer_secret**&[email protected]&password=ABCD+SecurityToken'

Check how to login testing REST API login using postmand

Test Salesforce Rest API using postman.

Lightning Login

You can Enable Lightning Login to give your users the enhanced speed, convenience, and security of password-free logins. After enabling Lightning Login and assigning the required permission to your users, encourage them to individually enroll in this password-free login feature.

What is Lightning Login?

Lightning Login allows you to login to Salesforce with only a username and the Salesforce Authenticator App. No passwords required. Learn more about how to enable Lightning login in Salesforce.

Login Flows In Salesforce

We learn different way to login. But what about if we need to customize the login Flow? Yes you can do it with Login Flow. You could also use Login flows to show “Terms & Conditions” page or “Privacy policy” Page and make users Accept during Login. Login flows will come for your rescue during deployments and Release to stop users from logging into System.

Have you ever wondered how Salesforce was showing Maintenance message?

Learn more about Login Flows in Salesforce.

YouTube video

How to grant login access to users?

System admin can use the Grand login access to help troubleshoot user issues to Salesforce org as the user experiencing the problem.

Step by step process for grand login access

  1. Click on Setup, enter Users in the Quick Find box, then select Users.
  2. Click the Login link next to the username. This link is available only for users who have granted login access to an admin or in orgs where admins can log in as any user.
  3. To return to your admin account, select User’s Name | Logout.

How to give Grant login access

  1. To provide grant login access go to your name then select My settings.
  2. Then from personal select Grant Account Login Access.
  3. You can provide grant access to your company administrator and  Salesforce.com support.

Login to Salesforce instance using SessionId

If you have session id and want to login without credentials? Then you could login to Salesforce directly using below URL hack.

https://[intance]/secur/frontdoor.jsp?sid=[sessionId]

Note : Be careful while using SessionId, If its publicly available then anyone can have access to your Salesforce Org.

Further learning

FAQ’s

how to login in Sandbox?

Use test.salesforce.com to login on sandbox or use custom domain URL to login.

How to login on Salesforce Trailhead Salesforce

Here is Trailhead Salesforce login URL https://trailhead.salesforce.com/ .

How to login as another user in Salesforce

You can use grand login functionality to login as another user.

Amit Chaudhary
Amit Chaudhary

Amit Chaudhary is Salesforce Application & System Architect and working on Salesforce Platform since 2010. He is Salesforce MVP since 2017 and have 17 Salesforce Certificates.

He is a active blogger and founder of Apex Hours.

Articles: 461

Leave a Reply

Your email address will not be published. Required fields are marked *