auth0 / passport-linkedin-oauth2

Passport Strategy for LinkedIn OAuth 2.0
MIT License
119 stars 107 forks source link

done object is not a function #31

Open chewedon opened 9 years ago

chewedon commented 9 years ago

I'm using Sailsjs,

I'm getting the an error:

object is not a function

For this line:

done(null, profile);

It appears "done" is being returned as an object and from my console log of the done object, it appears the done object s the user's profile.

Update

Erm...so I think I've fixed it.

In the other link:

https://github.com/auth0/passport-linkedin-oauth2/issues/29

I copied this line:

passReqToCallback: true

but after removing it, my return done(null, profile); works....

My only question is....shouldn't there be an extra step after that ?

According to the Linkedin documentation here:

https://developer.linkedin.com/docs/oauth2

I was expecting this library to make a POST request to:

https://www.linkedin.com/uas/oauth2/accessToken

with the following parameters:

I was watching my Google Chrome network monitor and I didn't see any such accessToken URL....

The Linkedin documentation also states I should get these two things afterwards:

access_token
expires_in

Is this extra step handled in the background for me ? Why doesn't my Google Chrome show any request to:

https://www.linkedin.com/uas/oauth2/accessToken

Anyone got any ideas ?

fiznool commented 9 years ago

You won't see these requests in your chrome inspector because the browser isn't responsible for this part of the oauth2 flow. The request for the access token is made server-server automatically by passport.js.

See this diagram for further information: https://github.com/fiznool/passportjs-example/blob/master/README.md#oauth-20-flow-diagram