PricingDocsAcademy
Bluesky ...
Wed, Dec 11, 10:46 PM

Logout button

  • /attachments/1131130610753220619/1131130610895831050/image.png

    Tom Wrench

    1 year ago

    Hi everyone! Just a quick question on how to get a button to logout a user?

    I'm using Superbase Auth, and thought that simply setting the session cookie to null or blank (instead of containing the token) would do the trick. However this isn't the case!

    Any tips? Thanks! 🙏
    image.png
    👍2
  • /attachments/1131130610753220619/1131202762739298324/image.png

    Croco_07

    1 year ago

    Hi ! not sure it's the good practice but setting the session cookie to an empty string seems to be working for me. Not sure though it is the recommended practice
    image.png
  • Andreas Møller

    1 year ago

    Hi Setting the session cookie can work, but the simples option is to link to /.toddle/logout

    Sorry this has not been documented yet :/
    👍4
  • Tom Wrench

    1 year ago

    /.toddle/logout works great. Thanks Andreas!
  • Tom Ireland

    1 year ago

    Sorry for reviving this old discussion but I was wondering what /.toddle/logout does, @Andreas Møller . My current method for logging out is to call logout via Supabase API and then set the session cookie to an empty value (it works) but was also wondering if that was the right way to go about it. When you say link to /.toddle/logout, is that 'Go to URL'?
  • Erik Beuschau

    1 year ago

    The logout endpoint sets the expiration time to 0 for both the id_token and the access_token and asks the browser to redirect to your front page (/)
  • /attachments/1131130610753220619/1161929148630048788/2023-10-12_09_29_33-cockpitcanari_-_main_Toddle_editor_Mozilla_Firefox.png

    Croco_07

    1 year ago

    @Tom Ireland I was doing like you but now use the toddle/logout endpoint and works very well !
    2023-10-12_09_29_33-cockpitcanari_-_main_Toddle_editor_Mozilla_Firefox.png
  • Tom Ireland

    1 year ago

    Thanks, @Erik Beuschau and @Croco_07 . That seems a sensible implementation just to be 100% everything is cleared properly.
  • Patrick Mast

    3 months ago

    I think this is worth documenting! 😉
    ❤️1
    💯2

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.