Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/LoginButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default function LoginButton(props: LoginButton) {
authType,
rerequest,
reauthorize,
extras,
onError,
onSuccess,
...rest
Expand All @@ -40,6 +41,7 @@ export default function LoginButton(props: LoginButton) {
authType,
rerequest,
reauthorize,
extras,
});

onSuccess?.(response);
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type LoginOptions = {
authType?: string[];
rerequest?: boolean;
reauthorize?: boolean;
extras?: Record<string, any>;
};

export default function useLogin() {
Expand Down
8 changes: 7 additions & 1 deletion src/utils/Facebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type LoginOptions = {
authType?: string[];
rerequest?: boolean;
reauthorize?: boolean;
extras?: Record<string, any>;
};
declare global {
interface Window {
Expand Down Expand Up @@ -173,11 +174,12 @@ export default class Facebook {
}

async login(options: LoginOptions) {
const { scope, authType = [], returnScopes, rerequest, reauthorize } = options;
const { scope, authType = [], returnScopes, rerequest, reauthorize, extras } = options;
const loginOptions: {
return_scopes?: boolean;
auth_type?: string;
scope?: string;
extras?: Record<string, any>;
} = {
scope,
};
Expand All @@ -198,6 +200,10 @@ export default class Facebook {
loginOptions.auth_type = authType.join(',');
}

if (extras) {
loginOptions.extras = extras;
}

return this.process<LoginResponse>(Namespace.LOGIN, [], [loginOptions]);
}

Expand Down