How are you guys refreshing the user's access_token for infinite sessions? (Supabase auth)

  • benjamin.h-1353045504153620584

    Ben H

    4 days ago

    I'm not using the Supabase SDK on the frontend, so it seems like I need to call supabase.auth.refreshSession() from an edge function? Is this how you guys are doing it? I.e. every time the user goes to the dashboard, call this endpoint to refresh their auth? Or could store the expiry date in local storage to avoid calling the endpoint as often.
  • Tod-1353045505982201989

    Tod

    4 days ago

    Great energy @Ben H! Your continuous contribution to the toddle Community just made you advance to Community Level 6!
  • benjamin.h-1354281835798073454

    Ben H

    1 day ago

    Anyone have thoughts on this?
  • paspom-1354400955613057044

    Pascal

    18 hours ago

    thats a good question
    I'm looking for a good solution too
    you could look up on page load, wheter the token is like 30 minutes or less away from expiration (assuming a user will be no longer than 30 minutes on one page, so that it is always "right on time")
    and if true, given that on page load, fire the refresh
    πŸ‘1
  • paspom-1354401306852462622

    Pascal

    18 hours ago

    only problem would be the access token, that is exchanged by that function, which could cause jwt problems when replacing a cookie suddenly without page reload
    πŸ‘1

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code β€” but accessible to your entire team!

Try toddle β€” it's free!

Β© Copyright 2024 toddle. All rights reserved.