Skip to content

Commit

Permalink
Merge pull request #15 from manosim/include-profile-picture
Browse files Browse the repository at this point in the history
Facebook Strategy: Include the profile picture in the payload
  • Loading branch information
TheRealFlyingCoder authored Jun 14, 2022
2 parents 8cefac5 + 437e864 commit 338b8cc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/strategies/facebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export type AdditionalFacebookProfileField =
| 'name_format'
| 'payment_pricepoints'
| 'political'
| 'picture'
| 'profile_pic'
| 'quotes'
| 'relationship_status'
Expand All @@ -103,6 +104,7 @@ export const baseProfileFields = [
'first_name',
'middle_name',
'last_name',
'picture',
];

export const FacebookDefaultScopes: FacebookScope[] = ['public_profile', 'email'];
Expand Down Expand Up @@ -204,6 +206,7 @@ export class FacebookStrategy<User> extends OAuth2Strategy<
},
);
const raw: FacebookProfile['_json'] = await response.json();
// Default Public Profile Fields: https://developers.facebook.com/docs/graph-api/reference/user/#fields
const profile: FacebookProfile = {
provider: SocialsProvider.FACEBOOK,
displayName: raw.name,
Expand All @@ -214,6 +217,7 @@ export class FacebookStrategy<User> extends OAuth2Strategy<
familyName: raw.last_name,
},
emails: [{ value: raw.email }],
photos: [{ value: raw.picture.data.url }],
_json: raw,
};
return profile;
Expand Down

0 comments on commit 338b8cc

Please sign in to comment.