Skip to content

Commit

Permalink
Remove deprecated username field
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaiklor committed Sep 30, 2015
1 parent f8865db commit ac85470
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "passport-facebook-token",
"version": "3.0.1",
"version": "3.0.2",
"description": "Facebook token authentication strategy for Passport",
"main": "lib/index.js",
"scripts": {
Expand Down
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class FacebookTokenStrategy extends OAuth2Strategy {
this._profileURL = options.profileURL || 'https://graph.facebook.com/v2.4/me';
this._clientSecret = options.clientSecret;
this._enableProof = options.enableProof;
this._profileFields = options.profileFields || ['id', 'username', 'name', 'emails'];
this._profileFields = options.profileFields || ['id', 'name', 'emails'];
this._oauth2._useAuthorizationHeaderForGET = false;
}

Expand Down Expand Up @@ -167,7 +167,6 @@ export default class FacebookTokenStrategy extends OAuth2Strategy {
let fields = [];
let map = {
'id': 'id',
'username': 'username',
'displayName': 'name',
'name': ['last_name', 'first_name', 'middle_name'],
'gender': 'gender',
Expand Down
6 changes: 3 additions & 3 deletions test/unit/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ describe('FacebookTokenStrategy:userProfile', () => {
sinon.stub(strategy._oauth2, 'get', (url, accessToken, next) => next(null, fakeProfile, null));

strategy.userProfile('accessToken', (error, profile) => {
assert.equal(strategy._oauth2.get.getCall(0).args[0], 'https://graph.facebook.com/v2.4/me?appsecret_proof=8c340bd01643ab69939ca971314d7a3d64bfb18946cdde566f12fdbf6707d182&fields=id,username,last_name,first_name,middle_name,email');
assert.equal(strategy._oauth2.get.getCall(0).args[0], 'https://graph.facebook.com/v2.4/me?appsecret_proof=8c340bd01643ab69939ca971314d7a3d64bfb18946cdde566f12fdbf6707d182&fields=id,last_name,first_name,middle_name,email');
strategy._oauth2.get.restore();
done();
});
Expand All @@ -281,13 +281,13 @@ describe('FacebookTokenStrategy:userProfile', () => {
let strategy = new FacebookTokenStrategy({
clientID: '123',
clientSecret: '123',
profileFields: ['username', 'name', 'custom']
profileFields: ['name', 'custom']
}, BLANK_FUNCTION);

sinon.stub(strategy._oauth2, 'get', (url, accessToken, next) => next(null, fakeProfile, null));

strategy.userProfile('accessToken', (error, profile) => {
assert.equal(strategy._oauth2.get.getCall(0).args[0], 'https://graph.facebook.com/v2.4/me?fields=username,last_name,first_name,middle_name,custom');
assert.equal(strategy._oauth2.get.getCall(0).args[0], 'https://graph.facebook.com/v2.4/me?fields=last_name,first_name,middle_name,custom');
strategy._oauth2.get.restore();
done();
});
Expand Down

0 comments on commit ac85470

Please sign in to comment.