New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@supabase/auth-helpers-sveltekit

Package Overview
Dependencies
Maintainers
5
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@supabase/auth-helpers-sveltekit - npm Package Compare versions

Comparing version 0.8.3 to 0.8.4

2

dist/constants.d.ts
export declare const PKG_NAME = "@supabase/auth-helpers-sveltekit";
export declare const PKG_VERSION = "0.8.3";
export declare const PKG_VERSION = "0.8.4";
export const PKG_NAME = '@supabase/auth-helpers-sveltekit';
export const PKG_VERSION = '0.8.3';
export const PKG_VERSION = '0.8.4';

@@ -12,2 +12,3 @@ import { getConfig } from '../config.js';

auth: {
autoRefreshToken: false,
storage: {

@@ -14,0 +15,0 @@ async getItem(key) {

{
"name": "@supabase/auth-helpers-sveltekit",
"version": "0.8.3",
"version": "0.8.4",
"description": "A collection of framework specific Auth utilities for working with Supabase.",

@@ -5,0 +5,0 @@ "type": "module",

@@ -219,5 +219,3 @@ # @supabase/auth-helpers-sveltekit (BETA)

}
const { data: tableData } = await supabaseClient
.from('test')
.select('*');
const { data: tableData } = await supabaseClient.from('test').select('*');

@@ -246,5 +244,3 @@ return {

}
const { data } = await supabaseClient
.from('test')
.select('*');
const { data } = await supabaseClient.from('test').select('*');

@@ -313,20 +309,23 @@ return json({ data });

const { error } = await supabaseClient.auth.signInWithPassword({ email, password });
const { error } = await supabaseClient.auth.signInWithPassword({
email,
password
});
if (error) {
if (error instanceof AuthApiError && error.status === 400) {
return invalid(400, {
error: 'Invalid credentials.',
values: {
email
}
});
}
return invalid(500, {
error: 'Server error. Try again later.',
values: {
email
}
});
}
if (error instanceof AuthApiError && error.status === 400) {
return invalid(400, {
error: 'Invalid credentials.',
values: {
email
}
});
}
return invalid(500, {
error: 'Server error. Try again later.',
values: {
email
}
});
}

@@ -343,1 +342,38 @@ throw redirect(303, '/dashboard');

```
## Protecting multiple routes
To avoid writing the same auth logic in every single route you can use the handle hook to
protect multiple routes at once.
```ts
// src/hooks.server.ts
import type { RequestHandler } from './$types';
import { getSupabase } from '@supabase/auth-helpers-sveltekit';
import { redirect, error } from '@sveltejs/kit';
export const handle: Handle = async ({ event, resolve }) => {
// protect requests to all routes that start with /protected-routes
if (event.url.pathname.startsWith('/protected-routes')) {
const { session, supabaseClient } = await getSupabase(event);
if (!session) {
throw redirect(303, '/');
}
}
// protect POST requests to all routes that start with /protected-posts
if (
event.url.pathname.startsWith('/protected-posts') &&
event.request.method === 'POST'
) {
const { session, supabaseClient } = await getSupabase(event);
if (!session) {
throw error(303, '/');
}
}
return resolve(event);
};
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc