✏️ Update imports in demo app

This commit is contained in:
RaviAnand Mohabir 2021-05-24 16:23:18 +02:00
parent d3c6b0ed8c
commit 500477a4e2

View File

@ -1,21 +1,21 @@
import { SvelteKitAuth } from "sk-auth"; import { SvelteKitAuth } from "sk-auth";
import { import {
FacebookAuthProvider, FacebookOAuth2Provider,
GoogleOAuthProvider, GoogleOAuth2Provider,
RedditOAuthProvider, RedditOAuth2Provider,
TwitterAuthProvider, TwitterAuthProvider,
} from "sk-auth/providers"; } from "sk-auth/providers";
export const appAuth = new SvelteKitAuth({ export const appAuth = new SvelteKitAuth({
providers: [ providers: [
new GoogleOAuthProvider({ new GoogleOAuth2Provider({
clientId: import.meta.env.VITE_GOOGLE_OAUTH_CLIENT_ID, clientId: import.meta.env.VITE_GOOGLE_OAUTH_CLIENT_ID,
clientSecret: import.meta.env.VITE_GOOGLE_OAUTH_CLIENT_SECRET, clientSecret: import.meta.env.VITE_GOOGLE_OAUTH_CLIENT_SECRET,
profile(profile) { profile(profile) {
return { ...profile, provider: "google" }; return { ...profile, provider: "google" };
}, },
}), }),
new FacebookAuthProvider({ new FacebookOAuth2Provider({
clientId: import.meta.env.VITE_FACEBOOK_OAUTH_CLIENT_ID, clientId: import.meta.env.VITE_FACEBOOK_OAUTH_CLIENT_ID,
clientSecret: import.meta.env.VITE_FACEBOOK_OAUTH_CLIENT_SECRET, clientSecret: import.meta.env.VITE_FACEBOOK_OAUTH_CLIENT_SECRET,
profile(profile) { profile(profile) {
@ -29,11 +29,11 @@ export const appAuth = new SvelteKitAuth({
return { ...profile, provider: "twitter" }; return { ...profile, provider: "twitter" };
}, },
}), }),
new RedditOAuthProvider({ new RedditOAuth2Provider({
apiKey: import.meta.env.VITE_REDDIT_API_KEY, apiKey: import.meta.env.VITE_REDDIT_API_KEY,
apiSecret: import.meta.env.VITE_REDDIT_API_SECRET, apiSecret: import.meta.env.VITE_REDDIT_API_SECRET,
profile(profile) { profile(profile) {
profile = RedditOAuthProvider.profileHandler(profile); profile = RedditOAuth2Provider.profileHandler(profile);
return { ...profile, provider: "reddit" }; return { ...profile, provider: "reddit" };
}, },
}), }),
@ -45,8 +45,8 @@ export const appAuth = new SvelteKitAuth({
token = { token = {
...token, ...token,
user: { user: {
...token.user, ...(token.user ?? {}),
connections: { ...token.user.connections, [provider]: account }, connections: { ...(token.user?.connections ?? {}), [provider]: account },
}, },
}; };
} }