Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

signOut does not clear user jwt from gotrue authorization header allowing gotrue operations and exposing user jwt #524

@GaryAustin1

Description

@GaryAustin1

Bug report

Describe the bug

This is from a user discussion on DISCORD

Although signOut clears the session data from local storage, it appears it leaves the user jwt in the gotrue headers object and in a second object called changedAccessToken.

If you run getUser() after signOut a request to the server goes out and the user data is returned.
Although database API calls revert to the anon key, the jwt could also be copied and used until it expires.

A temporary solution is probably to set the client "object" to null, or reinitialize the client if further work needs to be done after signout.

To Reproduce

console.log('login')
        const {data} = await supabase1.auth.signInWithPassword({email: 'email', password:'pass'} )
        console.log('login ',data)
        console.log('signOut ',await supabase1.auth.signOut())
        console.log('getSession ', await supabase1.auth.getSession())   //null
        console.log('supabase ',supabase1)  //see image below
        const result = await supabase1.from('realtest').select()  //authentication header anon
        console.log ('getUser ', await supabase1.auth.getUser())  //auth header has user jwt and returns user data from server

Supabase object after signOut()
signout

getUser going out with a user jwt after signOut().
image

Expected behavior

SignOut() should remove any jwt info from memory and certainly no allow gotrue operations to continue.

It is understood there is a risk of unexpired jwts after signOut, but they should not be left around for someone to find or use after signOut().

System information

supabase-js 2.0.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions