Table of contents
How to enable LinkedIn login in WordPress
1. App creation
To be able to log in via Linkedin you must create a Linkedin app first.
- Navigate to https://www.linkedin.com/developer/apps
- Log in with your LinkedIn credentials if you are not logged in
- Locate the “Create app” button and click on it.
- Enter the name of your App to the “App name” field.
- Find your page in the “LinkedIn Page” field. If you don’t have one yet, create a new one at: https://www.linkedin.com/company/setup/new/
- Enter your “Privacy policy URL” and upload an “App logo”
- Read and agree the “API Terms of Use” then click the “Create App” button!
- You will end up in the products area. If you aren’t already there, click on the “Products” tab.
- Find “Sign In with LinkedIn using OpenID Connect” and click “Request access”.
- A modal will appear where you need to tick the “I have read and agree to these terms” checkbox and finally press the “Request access” button.
- Click on the “Auth” tab.
- Find “OAuth 2.0 settings” section and add the following URL at “Authorized redirect URLs for your app”
- Click on “Update” to save the changes
- Find the necessary “Client ID” and “Client Secret” under the “Authentication keys” section, on the “Auth” tab.
2. App setup
Once your Linkedin app is ready you’ll need to copy and paste the Client ID and Client Secret to the Linkedin provider’s Settings tab. You can find the information at your Linkedin app’s Settings which you can reach from the left sidebar.
3. Verification
Once your Client ID and Client Secret has been added you need to verify the setup first. This verification helps you identify possible problems with the app.
Settings
Client ID
The Client ID of your Linkedin app. You can find it at your App under Authentication Keys.
Client Secret
The Client Secret of your Linkedin app. You can find it at your App under Authentication Keys.
Username prefix on Register
Whenever a new user registers with their LinkedIn account they can get a custom prefix so you can easily identify them.
Fallback username prefix on register
Whenever a new user registers with their LinkedIn account and we can not generate a valid username from the first name or last name, a random username will be generated. With this option they can get a custom prefix so you can easily identify them.
Terms and conditions
This option can only be seen, if Terms and conditions is set to Show in Global Settings → Privacy tab. Here you can set custom Terms and Conditions for users who register with LinkedIn. For more information please read our GDPR documentation.
Sync data
By default Nextend Social Login stores the first name, last name, email, avatar url and access token if it is possible, however some additional information can also be retrieved and stored.
When an option is checked, that field will be stored in a meta key with the specified name.
Sync fields
It determines when the synchronization shall happen.
- Register: whenever a new user registers with a provider, their data will be retrieved and stored.
- Login: whenever user logs in with a provider, their data will be retrieved and stored.
- Link: whenever user links and existing WordPress account with a provider, their data will be retrieved and stored.
Common error messages returned by LinkedIn during verification
redirect_uri does not match
The redirect_uri does not match the registered value
The problem is that the entered Authorized redirect URLs field is not correct for your app. Check the 12th step of the App setup to fix the problem.
client_id is invalid
The passed in client_id is invalid
The entered Client ID is not correct. Maybe the app with the entered ID was deleted. Go to the LinkedIn provider → Settings and make sure that an existing App’s Client ID and Client Secret was entered.
Client authentication failed
Error: invalid_client: Client authentication failed
The Client Secret you copied from the LinkedIn app is invalid. Make sure the correct one was copied.
Limitations
Don’t replace the LinkedIn App if you have users connected with LinkedIn
Whenever a person connects with LinkedIn login, an ID will be created, which is unique for the specific LinkedIn app that the login happened over. If the same person tries to login over another LinkedIn App, the person will receive another, completely different ID.
In Nextend Social Login, we use these IDs to recognize the WordPress account that the LinkedIn account was linked with. So if you replace the LinkedIn App, users with linked LinkedIn Accounts will no longer be able to login with the new App.
If you really need to replace the LinkedIn App, then users with linked LinkedIn accounts can only login with LinkedIn, if the person:
- logs in with the traditional username and password form or maybe with another provider that is also linked to the account
- unlinks the currently linked LinkedIn account
- and links the LinkedIn account again, using the new LinkedIn App
Each user can find the Link and Unlink buttons on the WordPress default profile page, e.g.:
- https://yoursite.com/wp-admin/profile.php
or you can display the Link and Unlink buttons using:
- the Nextend Social Login widget with Show link/unlink buttons enabled
- or the shortcode with the link and unlink parameters.