Skip to content

Commit

Permalink
Add email field to FacebookUser (#1068)
Browse files Browse the repository at this point in the history
  • Loading branch information
pilcrowonpaper authored Sep 4, 2023
1 parent b9b6d19 commit 4e6e507
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .auri/$n5h6ktgf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
package: "@lucia-auth/oauth" # package name
type: "minor" # "major", "minor", "patch"
---

Add `email` field `FacebookUser`
3 changes: 3 additions & 0 deletions documentation/content/oauth/providers/facebook.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@ type FacebookTokens = {

### `FacebookUser`

`email` is only included if `email` scope if provided.

```ts
type FacebookUser = {
id: string;
name: string;
email?: string;
picture: {
data: {
height: number;
Expand Down
3 changes: 2 additions & 1 deletion packages/oauth/src/providers/facebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class FacebookUserAuth<
const getFacebookUser = async (accessToken: string): Promise<FacebookUser> => {
const requestUrl = createUrl("https://graph.facebook.com/me", {
access_token: accessToken,
fields: ["id", "name", "picture"].join(",")
fields: ["id", "name", "picture", "email"].join(",")
});
const request = new Request(requestUrl, {
headers: {
Expand All @@ -125,6 +125,7 @@ export type FacebookTokens = {
export type FacebookUser = {
id: string;
name: string;
email?: string;
picture: {
data: {
height: number;
Expand Down

0 comments on commit 4e6e507

Please sign in to comment.