Skip to content

XProvider

Reference doc for the `XProvider`.

Use this provider to authenticate with X.com.

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

Methods

XProvider

XProvider(config)

Parameters

Returns Provider

Create a X.com OAuth2 provider.

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

XProviderConfig

XProviderConfig.clientID

Type string

The client ID.

This is just a string to identify your app.

{
clientID: "my-client"
}

XProviderConfig.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"
}

XProviderConfig.query?

Type Record<string, string>

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

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

XProviderConfig.scopes

Type string[]

A list of OAuth scopes that you want to request.

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