feathersjs-ecosystem / authentication-oauth2

[MOVED] OAuth 2 plugin for feathers-authentication
https://github.com/feathersjs/feathers
MIT License
26 stars 15 forks source link

Examples are no longer working due to missing email property #40

Closed binury closed 7 years ago

binury commented 7 years ago

The github object contains only a profile property and an accessToken.

The example provided (as well as an example within the Feathers core Docs akin to it) tries to access an undefined property.

The user's email can now be found within an array emails within hook.data.github.profile

binury commented 7 years ago

https://github.com/jaredhanson/passport-github/issues/15

binury commented 7 years ago

Here's how I grab the email from the payload:

hook.data.email = hook.data.github.profile.emails.find(email => email.primary).value;

Note: scope must include user:email to receive the emails object formatted with the additional properties. Otherwise, you will only receive the user's email from their profile which may not even exist if they've hidden it.

daffl commented 7 years ago

Can you update the examples or link to the ones you were refering to?

binury commented 7 years ago

Sure can. I'm referring to the examples in the readme of this repository which are also used in the main Feathers documentation.

daffl commented 7 years ago

Closed via #45