feat(facebook): add support for business login using config ids (#1990)

This commit is contained in:
Alexander Lyon
2025-04-11 10:42:07 +01:00
committed by GitHub
parent e24a60d717
commit 6b22e08c2b
2 changed files with 16 additions and 1 deletions

View File

@@ -34,6 +34,11 @@ description: Facebook provider setup and usage.
},
})
```
<Callout>
BetterAuth also supports Facebook Login for Business, all you need
to do is provide the `configId` as listed in **Facebook Login For Business > Configurations** alongside your `clientId` and `clientSecret`. Note that the app must be a Business app and, since BetterAuth expects to have an email address and account id, the configuration must be of the "User access token" type. "System-user access token" is not supported.
</Callout>
</Step>
<Step>
### Sign In with Facebook

View File

@@ -25,6 +25,11 @@ export interface FacebookOptions extends ProviderOptions<FacebookProfile> {
* @default ["id", "name", "email", "picture"]
*/
fields?: string[];
/**
* The config id to use when undergoing oauth
*/
configId?: string;
}
export const facebook = (options: FacebookOptions) => {
@@ -45,6 +50,11 @@ export const facebook = (options: FacebookOptions) => {
state,
redirectURI,
loginHint,
additionalParams: options.configId
? {
config_id: options.configId,
}
: {},
});
},
validateAuthorizationCode: async ({ code, redirectURI }) => {