How to login into Salesforce using Linkedin credentials?

1. Create a Linkedin app using the below link


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 =: 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.