Home » All Blogs » Salesforce Login

Salesforce Login

How to login in Salesforce? There are different way 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 Salesforce login URL? Login URL allow your to access your CRM System. There are there different URL to login into Salesforce:

  1. Production: You can use below Salesforce login url to access the Salesforce production or Developer org
    • https://login.salesforce.com/
  2. Sandbox: You can login in Sandbox using 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.

How to login Using Custom Domain

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

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

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

Salesforce Login Parameter

Some time you need to login into Salesforce using another organization (Not SSO) for that you need to pass parameter to login. In that case use can pass below param to access Salesforce.

  • un: un used for username
  • 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.

How To Implement Single Sign-On In Salesforce

There are three mechanisms which 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.

Further learning

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: 400

Leave a Reply