Giter VIP home page Giter VIP logo

Comments (4)

mqp avatar mqp commented on May 26, 2024 2

Yep, setting autoRefreshToken to false works for us. My only complaint is that the default failed silently in a nasty way and there wasn't really any documentation calling out what I needed to do in a server context for it to be OK, so it seems like there could be room for improvement. For example, the code could interpret the default autoRefreshToken: undefined like true in a browser and false on Node, although maybe that would trick other people, who might use a single-long-lived client whose access token expires after a while.

from supabase-js.

j4w8n avatar j4w8n commented on May 26, 2024 1

I'm guessing you're not using an auth helper package to create the client.

If using the native createClient function, you'll want to set these auth options for that server client.

autoRefreshToken: false,
detectSessionInUrl: false,
persistSession: false

This is assuming that you're not keeping track of a user session with this client.

from supabase-js.

j4w8n avatar j4w8n commented on May 26, 2024

Yeah I think there used to be a small blurb about this in the docs, but I can't find it now.

They could set it up to be automagic based on a browser context - this is what auth helpers/ssr does - but that would be a breaking change for the native client function.

from supabase-js.

kangmingtay avatar kangmingtay commented on May 26, 2024

@mqp these are good points - perhaps we could use something like FinalizationRegistry to register a cleanup method when the class is instantiated on the server-side.

although it seems like they have a huge warning too :/ (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry#avoid_where_possible)

from supabase-js.

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.