-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
bklaing2
committed
Jun 23, 2024
1 parent
ac72706
commit 4ed0b3e
Showing
1 changed file
with
18 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
import { SPOTIFY_REDIRECT } from "$env/static/private"; | ||
import { redirect } from '@sveltejs/kit' | ||
|
||
|
||
const SCOPES = [ | ||
'user-follow-read', | ||
'playlist-read-private', | ||
'playlist-modify-public', | ||
'playlist-modify-private', | ||
'ugc-image-upload' | ||
'user-follow-read', | ||
'playlist-read-private', | ||
'playlist-modify-public', | ||
'playlist-modify-private', | ||
'ugc-image-upload' | ||
] | ||
|
||
|
||
export const actions = { | ||
default: async ({ locals }) => { | ||
const { data, error } = await locals.supabase.auth.signInWithOAuth({ | ||
provider: 'spotify', | ||
options: { scopes: SCOPES.join(' ') } | ||
}) | ||
const { data, error } = await locals.supabase.auth.signInWithOAuth({ | ||
provider: 'spotify', | ||
options: { | ||
scopes: SCOPES.join(' '), | ||
redirectTo: SPOTIFY_REDIRECT | ||
} | ||
}) | ||
|
||
if (error) throw new Error(error.message) | ||
throw redirect(303, data.url as string) | ||
} | ||
} | ||
|
||
if (error) throw new Error(error.message) | ||
throw redirect(303, data.url as string) | ||
} | ||
} |