simov / grant

OAuth Proxy
MIT License
4.08k stars 257 forks source link

Linked in profile url outdated #252

Closed eroo36 closed 3 years ago

eroo36 commented 3 years ago

In config/profile.json it is "profile_url": "https://api.linkedin.com/v1/people/~" and I couldn't manage to get profile info from linked in. New URL is "https://api.linkedin.com/v2/me?oauth2_access_token=token". I can use this but I couldn't figure out how I can change the query to oauth2_access_token in the package, so what can we do here?

simov commented 3 years ago

Thanks for the feedback, I will updated it. In the meantime you can setup linkedin like this:

{
  linkedin: {
    profile_url: 'https://api.linkedin.com/v2/me',
    // .. the rest of your configuration
  }
}

According to their docs you don't need to specify the querystring parameter, and by default Grant will send your access token as Authorization Bearer header instead.

Let me know if it works.

eroo36 commented 3 years ago

Thanks for your quick response, I will try this

simov commented 3 years ago

@Eroo36 this needed a little fix because of some leftovers from the previous API version for LinkedIn. If you pull master branch you will be able to login.

eroo36 commented 3 years ago

Hey thanks, it works now, but now it has another problem. I was not able to get the email with this

"linkedin": {
        "client_id": "",
        "secret": "",
        "callback": "/callback",
        "scope": ["r_emailaddress", "r_liteprofile"],
        "response": ["tokens", "profile"]
    } 

I tried putting other responses but couldn't get it, I looked at it a little, and apparently you are supposed to use another URL to get email which is funny. https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~)))

It is possible to get the email as well with that usual method? Maybe I am missing something about the config, if not I guess gotta get email manually

simov commented 3 years ago

That's a limitation on their end. If that's the case then you will have to pick one of the endpoints and get either the profile or the email. Generally Grant tries to do a single request for the profile_url endpoint.

eroo36 commented 3 years ago

Alright, thanks for your help!!