ewdave / passport-nylas

Nylas authentication strategy for Passport using the OAuth 2.0 API
MIT License
5 stars 2 forks source link

State param inside the verify callback #4

Open alerosa opened 6 years ago

alerosa commented 6 years ago

Hi, I'm using your passport-nylas and I have some trouble getting access to the state param in my verifier callback. (https://docs.nylas.com/reference#oauthauthorize) Basically, I'm passing the state parameter to Nylas, like this .../auth/nylas?state=something and I have it back from Nylas inside req.query along with code.

Checking the source code of your library I've noticed that the 'verify' callback is called only with the email coming from the oAuth token request: https://github.com/ewdave/passport-nylas/blob/master/nylas-strategy.js#L176 so the entire request object is not available inside the verifier callback.

What do you think about passing the the entire request object + the email instead of only the email to the verifier callback? It would be a breaking change but I don't have any better idea :)

Thanks a lot and keep up the good work!

cdimitroulas commented 6 years ago

@ewdave have you had a look at this?

ewdave commented 6 years ago

Ahhh not yet @alerosa @cdimitroulas Apologies. I totally missed this issue.