Created
July 26, 2021 15:19
-
-
Save robertohuertasm/ff5e94b7bc83c643711c61976ea9e806 to your computer and use it in GitHub Desktop.
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
import { SvelteKitAuth, Providers } from 'sk-auth'; | |
// this is the domain we set up in our Cognito Pool | |
const DOMAIN = 'sveltekit.auth.eu-west-1.amazoncognito.com'; | |
// these are the configuration seetings for our OAUTH2 provider | |
const config = { | |
accessTokenUrl: `https://${DOMAIN}/oauth2/token`, | |
profileUrl: `https://${DOMAIN}/oauth2/userInfo`, | |
authorizationUrl: `https://${DOMAIN}/oauth2/authorize`, | |
redirect: 'https://robertohuertas.com', | |
clientId: import.meta.env.VITE_CLIENT_ID, | |
clientSecret: import.meta.env.VITE_CLIENT_SECRET, | |
scope: ['openid', 'email'], | |
id: 'cognito', // IMPORTANT: this is the id that we'll use to identify our provider | |
contentType: 'application/x-www-form-urlencoded' | |
}; | |
const oauthProvider = new Providers.OAuth2Provider(config); | |
// exposing our auth object | |
export const appAuth = new SvelteKitAuth({ | |
providers: [oauthProvider] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment