You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
supabase.auth.signOut() fails if the user has been deleted. The error is AuthApiError: User from sub claim in JWT does not exist
To Reproduce
See code below (under "Additional context")
Expected behavior
supabase.auth.signOut() should clear the local cache if the user has been deleted.
System information
OS: iOS
Version of supabase-js: 2.25.0
Version of Node.js: 18.19.0
Additional context
My app needs to allow users to delete their accounts. In order to do this, I have created a database function that does the following:
` -- Get the user's ID and email address
SELECT id, email INTO user_id, user_email FROM auth.users WHERE id = auth.uid();
-- Insert a record into the deleted_users table
INSERT INTO public.deleted_users (id, email)
VALUES (user_id, user_email);
-- Delete the user from the auth.users table
DELETE FROM auth.users WHERE id = user_id;`
I call this from the client with:
await supabase.rpc('delete_user')
This successfully deletes the user from auth.users, and deletes their session and refresh token from the db as well. However, the user's session is still cached locally on the client (I'm using React Native/Expo). Thus, I need to log the user out locally. However, calling await supabase.auth.signOut() fails with the error:
AuthApiError: User from sub claim in JWT does not exist
The text was updated successfully, but these errors were encountered:
Describe the bug
supabase.auth.signOut() fails if the user has been deleted. The error is
AuthApiError: User from sub claim in JWT does not exist
To Reproduce
See code below (under "Additional context")
Expected behavior
supabase.auth.signOut() should clear the local cache if the user has been deleted.
System information
Additional context
My app needs to allow users to delete their accounts. In order to do this, I have created a database function that does the following:
` -- Get the user's ID and email address
SELECT id, email INTO user_id, user_email FROM auth.users WHERE id = auth.uid();
-- Insert a record into the deleted_users table
INSERT INTO public.deleted_users (id, email)
VALUES (user_id, user_email);
-- Delete the user from the auth.users table
DELETE FROM auth.users WHERE id = user_id;`
I call this from the client with:
await supabase.rpc('delete_user')
This successfully deletes the user from auth.users, and deletes their session and refresh token from the db as well. However, the user's session is still cached locally on the client (I'm using React Native/Expo). Thus, I need to log the user out locally. However, calling
await supabase.auth.signOut()
fails with the error:AuthApiError: User from sub claim in JWT does not exist
The text was updated successfully, but these errors were encountered: