feathersjs-ecosystem / authentication-oauth2

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

`facebook.profileFields` not works properly #57

Closed Albert-Gao closed 7 years ago

Albert-Gao commented 7 years ago

Steps to reproduce

This is my profileFields in the default.json

"profileFields": [
                "id",
                "name",
                "short_name",
                "displayName",
                "first_name",
                "last_name",
                "email",
                "gender",
                "verified", 
                "is_verified", 
                "profileUrl",
                "birthday",
                "picture",
                "timezone", 
                "currency", 
                "locale",
                "permissions",
                "updated_time"
            ]

However, when the facebook return result to this page http://localhost:5678/auth/facebook/callback with the auth code, I always get a 500.

The DEBUG=feathers-authentication* shows the following error:

feathers-authentication:passport:authenticate Error in 'facebook' authentication strategy { FacebookGraphAPIError: Syntax error "Field first_name specified more than once. This is only possible before version 2.1" at character 62: id,last_name,first_name,middle_name,short_name,name,first_name,last_name,email,gender,verified,is_verified,link,birthday,picture,timezone,currency,locale,permissions,updated_time
    at /Users/albertgao/codes/self/projectSwap/node_modules/passport-facebook/lib/strategy.js:165:21
    at passBackControl (/Users/albertgao/codes/self/projectSwap/node_modules/oauth/lib/oauth2.js:132:9)
    at IncomingMessage.<anonymous> (/Users/albertgao/codes/self/projectSwap/node_modules/oauth/lib/oauth2.js:157:7)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1056:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  name: 'FacebookGraphAPIError',
  message: 'Syntax error "Field first_name specified more than once. This is only possible before version 2.1" at character 62: id,last_name,first_name,middle_name,short_name,name,first_name,last_name,email,gender,verified,is_verified,link,birthday,picture,timezone,currency,locale,permissions,updated_time',
  type: 'OAuthException',
  code: 2500,
  subcode: undefined,
  traceID: 'GfPs7cst4Mv',
  status: 500 } +2s
  feathers-authentication:middleware:failure-redirect Clearing old 'feathers-jwt' cookie +1m

Expected behavior

No error happens

Actual behavior

Some fields which have been added implicitly and cause conflicts with my settings

System configuration

All latest modules with OS X

daffl commented 7 years ago

According to this name is a shortcut for first_name, last_name, middle_name. Removing name from the list will probably fix your problem.

Albert-Gao commented 7 years ago

Thanks, solved!