Skip to content

Commit

Permalink
Fix authProvider.getPermissions() should not throw error when not l…
Browse files Browse the repository at this point in the history
…ogged in

## Problem

The current setup disallows unauthenticated custom routes: the user is redirected to login.

## Solution

If no user is logged in, `getPermissions` should return `undefined` instead of redirecting to login.
  • Loading branch information
fzaninotto committed Oct 28, 2024
1 parent 796bb8d commit c28f5a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/ra-supabase-core/src/authProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ export const supabaseAuthProvider = (

const { data, error } = await client.auth.getUser();
if (error) {
throw error;
return;
}
if (data.user == null) {
return undefined;
return;
}

if (typeof getPermissions === 'function') {
Expand Down

0 comments on commit c28f5a7

Please sign in to comment.