GithubHelp home page GithubHelp logo

"supabase.auth.getUser()" is returning a null user value in nextjs middleware.ts using @supabase/supabase-js @supabase/ssr only about supabase HOT 3 OPEN

kritik-sah avatar kritik-sah commented on June 17, 2024 2
"supabase.auth.getUser()" is returning a null user value in nextjs middleware.ts using @supabase/supabase-js @supabase/ssr only

from supabase.

Comments (3)

simonha9 avatar simonha9 commented on June 17, 2024

Hi! Is there a specific reason why calling auth.getUser() in your protected route to see if they are logged in and then kicking them out is not an option? It seems like the guide you linked does exactly that in the last step. afaik there won't be a user before a code exchange is done, which looks like that is the case in the attached picture because I only see the code challenge.

from supabase.

d-e-h-i-o avatar d-e-h-i-o commented on June 17, 2024

We're also experiencing a similar problem. On our server, we're having the following check:

    const authenticatedUser = await this.supabaseAdminClient.auth.getUser(jwtToken)
    if (!authenticatedUser.data.user) {
      this.logger.debug('No user is associated with the access token!')
      return false
    }

However, sometimes, even though we are using a valid jwt, await this.supabaseAdminClient.auth.getUser(jwtToken) is returning null.

"@supabase/supabase-js": "^2.39.8"

from supabase.

aaa3334 avatar aaa3334 commented on June 17, 2024

Think this is the same issue I reported here:
#22719

Logging in twice gets it to set - somoeone suggested the set method is only setting one cookie at a time...

from supabase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.