/logout meant to send to 404?

  • /attachments/1318135798524149890/1318135798985392190/Screenshot_2024-12-16_at_9.39.23_PM.png

    Alex

    1 month ago

    Whats the correct way to log someone out of my toddle app that's using Supabase Auth?

    I heard it was to just action a 'gotourl' "/logout" - but currently this sends user to /404

    How can I send them back to /login page or /homepage ?
    Screenshot_2024-12-16_at_9.39.23_PM.png
  • Alex

    1 month ago

    I fixed it with adding "/.toddle/logout"

    πŸ™‚
    πŸ‘πŸ½3
  • Tom Ireland

    1 month ago

    When using a relative URL in the Go to URL action, the page must exist, so it sounds like you have not created a logout page, however you likely won't need this.

    You can use the Supabase logout endpoint, however I default to using /.toddle/logout in the Go to URL action, which destroys the session and logs the user out with a redirect to the homepage.
  • Oh, just saw your latest comment. πŸ˜„
  • Alex

    1 month ago

    haha your description is helpful though!
  • So, how could I redirect them somewhere else and still destroy everything?
  • Tom Ireland

    1 month ago

    You'd need to call the Supabase logout URL and - on success - redirect to wherever you want. You'd need to update the session cookie so that it's null on success as well (I think).
  • I say "I think" because I cannot remember if it's null or 0. I believe null will work subject to being proven otherwise.
  • Alex

    1 month ago

    oh I know that method, sorry I thought there was another /.toddle/ type of action we could use πŸ™‚
  • Tom Ireland

    1 month ago

    I know it's possible to add ?redirect_to= query param after saving an access token but not sure about the other way around. You could try Go to URL /.toddle/logout?redirect_to={your URL} but I've never tried it.
  • Alex

    1 month ago

    it;s okay, homepage is perfect πŸ™‚ was just curious
  • so much easier using the .toddle/lgout call haha
    πŸ’―1
  • Armand

    1 month ago

    I found this discussion relating to this: Logout button
    πŸ”₯1
  • Alex

    1 month ago

    yep I found that seconds after I posted this thread hahha..
  • Armand

    1 month ago

    it's good practice to actively engage in stuff like this again πŸ˜‰
  • like group practice

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.