How to login into Salesforce using Linkedin credentials?

How to login into Salesforce using Linkedin credentials?

1. Create a Linkedin app using the below link

https://www.linkedin.com/secure/developer?newapp=

Note: Make sure Default Scopes are selected.

2. Save the application Details.

3. Create Auth Provider in Salesforce.

4. Modify the handler class as below

Handler Class:

global class AutocreatedRegHandler1416835537727 implements Auth.RegistrationHandler{
    global User createUser(Id portalId, Auth.UserData data) {
        User u = [SELECT Id FROM User WHERE Email =: data.email OR FirstName =: data.FirstName];
        return u;
    }
    
    global void updateUser(Id userId, Id portalId, Auth.UserData data) {
    }
}

5. Copy the callback URL.

6. Paste it in Linkedin App.

7. Use “Single Sign-On Initialization URL” to login into Salesforce using Linkedin Credentials.

8. Click “Allow Access” to login into Salesforce using Linkedin credentials.

Cheers!!!

Leave a Reply