SpotifyProvider
Reference doc for the `SpotifyProvider`.
Use this provider to authenticate with Spotify.
import { SpotifyProvider } from "@openauthjs/openauth/provider/spotify"
export default issuer({ providers: { spotify: SpotifyProvider({ clientID: "1234567890", clientSecret: "0987654321" }) }})
Methods
SpotifyProvider
SpotifyProvider(config)
Parameters
The config for the provider.config
SpotifyConfig
Returns Provider
Create a Spotify OAuth2 provider.
SpotifyProvider({ clientID: "1234567890", clientSecret: "0987654321"})
SpotifyConfig
-
clientID
string
-
clientSecret
string
-
pkce?
boolean
-
query?
Record
<
string
,string
>
-
scopes
string
[]
SpotifyConfig.clientID
Type string
The client ID.
This is just a string to identify your app.
{ clientID: "my-client"}
SpotifyConfig.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"}
SpotifyConfig.pkce?
Type boolean
Default false
Whether to use PKCE (Proof Key for Code Exchange) for the authorization code flow. Some providers like x.com require this.
SpotifyConfig.query?
Type Record
<
string
, string
>
Any additional parameters that you want to pass to the authorization endpoint.
{ query: { access_type: "offline", prompt: "consent" }}
SpotifyConfig.scopes
Type string
[]
A list of OAuth scopes that you want to request.
{ scopes: ["email", "profile"]}