Spotify OAuth

Spotify OAuth with PKCE and user profile scopes.

Overview

Spotify supports PKCE (S256) by default. Recommended scopes include user-read-emailand user-read-private for profile access.

Environment

# .env.local
AUTH_SECRET=your-secret-key-min-32-chars-long
SPOTIFY_CLIENT_ID=your-spotify-client-id
SPOTIFY_CLIENT_SECRET=your-spotify-client-secret
SPOTIFY_REDIRECT_URI=http://localhost:3000/api/auth/callback/spotify

Configuration

Basic Spotify OAuth Setup

Minimal configuration

import { spotify } from '@warpy-auth-sdk/core';

const provider = spotify({
  clientId: process.env.SPOTIFY_CLIENT_ID!,
  clientSecret: process.env.SPOTIFY_CLIENT_SECRET!,
  redirectUri: process.env.SPOTIFY_REDIRECT_URI!,
  scope: ['user-read-email', 'user-read-private'],
});

Profile Images

The SDK maps images[0].url to the user picture when available.
Spotify OAuth | @warpy-auth-sdk/core