Skip to content

Commit

Permalink
feat(): allow passing funciton for LoginOptions.auth_nonce
Browse files Browse the repository at this point in the history
resolves #56
  • Loading branch information
greatSumini committed Apr 29, 2022
1 parent 3882448 commit 177ed88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/facebook-login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export default function FacebookLogin(props: FacebookLoginProps) {
auth_type: '',
return_scopes: false,
...props.loginOptions,
auth_nonce:
typeof props.loginOptions?.auth_nonce === 'function'
? props.loginOptions.auth_nonce()
: props.loginOptions?.auth_nonce,
scope,
};

Expand Down
2 changes: 1 addition & 1 deletion src/types/params.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export type LoginOptions = {
return_scopes?: boolean;

/** The auth_nonce parameter is intended to be a completely arbitrary alphanumeric code that your app generates. The process of generation and format of this code is entirely up to you. For example, a hashed version of a timestamp and a secret string may be sufficient, as long as it's completely unique to each Login attempt. This value enables your app to determine whether a user has been re-authenticated. */
auth_nonce?: string;
auth_nonce?: string | (() => string);
};

export type FacebookLoginProps = Pick<InitParams, 'appId'> & {
Expand Down

0 comments on commit 177ed88

Please sign in to comment.