From f3ffe44957ddea238bf7d578586043dcfeb0823f Mon Sep 17 00:00:00 2001 From: Alexander Staroselsky Date: Tue, 11 Jan 2022 09:52:45 -0700 Subject: [PATCH] feat: add spotify oauth2 provider --- app/src/global.d.ts | 2 ++ app/src/lib/appAuth.ts | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/app/src/global.d.ts b/app/src/global.d.ts index f4d31c5..36173c0 100644 --- a/app/src/global.d.ts +++ b/app/src/global.d.ts @@ -11,5 +11,7 @@ interface ImportMetaEnv { VITE_TWITTER_API_SECRET: string; VITE_REDDIT_API_KEY: string; VITE_REDDIT_API_SECRET: string; + VITE_SPOTIFY_API_KEY: string; + VITE_SPOTIFY_API_SECRET: string; VITE_JWT_SECRET_KEY: string; } diff --git a/app/src/lib/appAuth.ts b/app/src/lib/appAuth.ts index 31e3203..d9397b9 100644 --- a/app/src/lib/appAuth.ts +++ b/app/src/lib/appAuth.ts @@ -5,6 +5,7 @@ import { GoogleOAuth2Provider, RedditOAuth2Provider, TwitterAuthProvider, + SpotifyOAuth2Provider, } from "sk-auth/providers"; export const appAuth = new SvelteKitAuth({ @@ -45,6 +46,13 @@ export const appAuth = new SvelteKitAuth({ return { ...slim, provider: "reddit" }; }, }), + new SpotifyOAuth2Provider({ + apiKey: import.meta.env.VITE_SPOTIFY_API_KEY, + apiSecret: import.meta.env.VITE_SPOTIFY_API_SECRET, + profile(profile) { + return { ...profile, provider: "spotify" }; + }, + }), ], callbacks: { jwt(token, profile) {