Search code examples
laravelvue.jslinkedin-api

Is it possible to import a user's linkedin job title or profile in general?


I'm reading documentation but it is not very clear to me.

I would like to build a button where a logged in user can click, get redirected to linkedin to give me read access to their profile, and then me getting this information back.

Is this something that is possible?

I'm using Vue + Laravel


Solution

  • Short answer - yes. Just like how you can sign in with Google, Twitter, Facebook, etc - which allows you certain access to a person's profile information, you can also get a person's LinkedIn information via oAuth.

    The LinkedIn documentation is here: https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context And an example using Laravel is here: https://codebriefly.com/laravel-socialite-linkedin-login-part-2/

    In short, you need to:

    1. Create a LinkedIn developer portal account and register your app there: https://www.linkedin.com/developers/
    2. Obtain a client ID and client Secret
    3. Make a GET request to https://www.linkedin.com/oauth/v2/authorization to get an auth code
    4. If the user approves access you'll get an auth code back, which you can exchange for an access token by making a POST request to https://www.linkedin.com/oauth/v2/accessToken
    5. You can now get the user's information by making GET requests using the access token as an authorization header.