Skip to content

Instantly share code, notes, and snippets.

friendly rustacean

Roberto Huertas robertohuertasm

friendly rustacean
View GitHub Profile

Keybase proof

I hereby claim:

  • I am robertohuertasm on github.
  • I am robertohuertasm ( on keybase.
  • I have a public key ASDpvIt8m-C06M2ZPwPtlAKy4nfh9ddOS3hb4FFPiVgHGQo

To claim this, I am signing this object:

View sveltekit-cognito.index.svelte
import { signOut as authSignOut } from 'sk-auth/client';
import { session } from '$app/stores';
// getting the user from the session store
$: user = $session.user;
function signIn() {
View sveltekit-cognito.hooks.js
import { appAuth } from '$lib/auth';
export const { getSession } = appAuth;
View sveltekit-cognito.[...auth].js
// we're importing our auth object here
import { appAuth } from '$lib/auth';
// and exposing the get and post method handlers
export const { get, post } = appAuth;
View sveltekit-cognito.env
View sveltekit-cognito.auth.js
import { SvelteKitAuth, Providers } from 'sk-auth';
// this is the domain we set up in our Cognito Pool
const DOMAIN = '';
// 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`,
View sveltekit-cognito.ui.svelte
// we'll edit this later
let user;
<title>SvelteKit - Cognito</title>
{#if !user}
npm init svelte@next sveltekit-cognito-auth
# I'm choosing the Skeleton project,
# opting out of TypeScript for this tutorial
# and using ESlint and Prettier support
cd sveltekit-cogniton-auth
npm install