feat: Spotify integration (OAuth + voice tools)
Some checks failed
Deploy / deploy (push) Failing after 1m40s
Some checks failed
Deploy / deploy (push) Failing after 1m40s
This commit is contained in:
20
app/api/spotify/auth/route.ts
Normal file
20
app/api/spotify/auth/route.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export const dynamic = 'force-dynamic'
|
||||
import { NextResponse } from 'next/server'
|
||||
|
||||
export async function GET() {
|
||||
const clientId = process.env.SPOTIFY_CLIENT_ID!
|
||||
const redirectUri = `${process.env.NEXT_PUBLIC_APP_URL}/api/spotify/callback`
|
||||
const scopes = [
|
||||
'user-read-playback-state',
|
||||
'user-modify-playback-state',
|
||||
'user-read-currently-playing',
|
||||
].join(' ')
|
||||
|
||||
const url = new URL('https://accounts.spotify.com/authorize')
|
||||
url.searchParams.set('response_type', 'code')
|
||||
url.searchParams.set('client_id', clientId)
|
||||
url.searchParams.set('scope', scopes)
|
||||
url.searchParams.set('redirect_uri', redirectUri)
|
||||
|
||||
return NextResponse.redirect(url.toString())
|
||||
}
|
||||
Reference in New Issue
Block a user