mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-10 20:37:46 +00:00
feat(facebook): add support for business login using config ids (#1990)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 }) => {
|
||||
|
||||
Reference in New Issue
Block a user