Skip to content

FacebookProvider

Reference doc for the `FacebookProvider`.

Use this provider to authenticate with Facebook. Supports both OAuth2 and OIDC.

Using OAuth

import { FacebookProvider } from "@openauthjs/openauth/provider/facebook"
export default issuer({
providers: {
facebook: FacebookProvider({
clientId: "1234567890",
clientSecret: "0987654321"
})
}
})

Using OIDC

import { FacebookOidcProvider } from "@openauthjs/openauth/provider/facebook"
export default issuer({
providers: {
facebook: FacebookOidcProvider({
clientId: "1234567890"
})
}
})

Methods

FacebookOidcProvider

FacebookOidcProvider(config)

Parameters

Returns Provider

Create a Facebook OIDC provider.

This is useful if you just want to verify the user’s email address.

FacebookOidcProvider({
clientId: "1234567890"
})

FacebookProvider

FacebookProvider(config)

Parameters

Returns Provider

Create a Facebook OAuth2 provider.

FacebookProvider({
clientId: "1234567890",
clientSecret: "0987654321"
})

FacebookConfig

FacebookConfig.clientID

Type string

The client ID.

This is just a string to identify your app.

{
clientID: "my-client"
}

FacebookConfig.clientSecret

Type string

The client secret.

This is a private key that’s used to authenticate your app. It should be kept secret.

{
clientSecret: "0987654321"
}

FacebookConfig.query?

Type Record<string, string>

Any additional parameters that you want to pass to the authorization endpoint.

{
query: {
access_type: "offline",
prompt: "consent"
}
}

FacebookConfig.scopes

Type string[]

A list of OAuth scopes that you want to request.

{
scopes: ["email", "profile"]
}

FacebookOidcConfig

FacebookOidcConfig.clientID

Type string

The client ID.

This is just a string to identify your app.

{
clientID: "my-client"
}

FacebookOidcConfig.query?

Type Record<string, string>

Any additional parameters that you want to pass to the authorization endpoint.

{
query: {
prompt: "consent"
}
}

FacebookOidcConfig.scopes?

Type string[]

A list of OIDC scopes that you want to request.

{
scopes: ["openid", "profile", "email"]
}