feat: add spotify oauth2 provider

This commit is contained in:
Alexander Staroselsky 2022-01-11 09:52:45 -07:00
parent 23293cfbcf
commit f3ffe44957
2 changed files with 10 additions and 0 deletions

2
app/src/global.d.ts vendored
View File

@ -11,5 +11,7 @@ interface ImportMetaEnv {
VITE_TWITTER_API_SECRET: string; VITE_TWITTER_API_SECRET: string;
VITE_REDDIT_API_KEY: string; VITE_REDDIT_API_KEY: string;
VITE_REDDIT_API_SECRET: string; VITE_REDDIT_API_SECRET: string;
VITE_SPOTIFY_API_KEY: string;
VITE_SPOTIFY_API_SECRET: string;
VITE_JWT_SECRET_KEY: string; VITE_JWT_SECRET_KEY: string;
} }

View File

@ -5,6 +5,7 @@ import {
GoogleOAuth2Provider, GoogleOAuth2Provider,
RedditOAuth2Provider, RedditOAuth2Provider,
TwitterAuthProvider, TwitterAuthProvider,
SpotifyOAuth2Provider,
} from "sk-auth/providers"; } from "sk-auth/providers";
export const appAuth = new SvelteKitAuth({ export const appAuth = new SvelteKitAuth({
@ -45,6 +46,13 @@ export const appAuth = new SvelteKitAuth({
return { ...slim, provider: "reddit" }; 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: { callbacks: {
jwt(token, profile) { jwt(token, profile) {