PricingBlog

API Call responding weird, maybe sessions?

  • alexsiale_17363-1276102295351853108

    Alex

    1 year ago

    See the images below, first is when visiting the site without logging in. There is a GET call to my public Supabase table of 'Renders' or 'CaseStudies'. It works great.

    Then, when you log in as a user and go back to the home page, it filters it by what I assume is the user_id and because the user I tested with doesn't have any Renders stored, the home page GET call is blank.

    Then, I log out and visit the home page again and it's doing the same blank GET call...

    Am I structuring my API call wrong here? Or is the session storing a key that is staying set even after a logout?

    Help would be awesome.
    1276102296090181689-Screenshot_2024-08-22_at_8.50.40_PM.png
    1276102296727719988-Screenshot_2024-08-22_at_8.51.07_PM.png
    1276102297113460798-Screenshot_2024-08-22_at_8.50.58_PM.png
  • plusmin-1276109849750536213

    Armand

    1 year ago

    I'm not sure about the 2nd behaviour (logging out and getting a blank page), but for the first behaviour (logging in and not seeing any renders), I would suggest to check your RLS policy. If it is indeed set to only show renders whose owner created them, then that's probably why they are not showing up for other users.
  • alexsiale_17363-1276114664551354462

    Alex

    1 year ago

    Yeah I’m going to have a look around and see what’s up
  • max.kayr-1276116188060979233

    Max

    1 year ago

    How do you log out?
  • alexsiale_17363-1276126337660223619

    Alex

    1 year ago

    Just the Supabase Logout API call
  • Should I be unsettling a token on logout also?
  • chrislaupama-1276131097561927722

    Chris Laupama

    1 year ago

    You clearing the session cookie?
  • tomthebigtree-1276166486599139431

    Tom Ireland

    1 year ago

    Re the logout stuff, probably an idea to add Go to URL => /.toddle/logout after your Supabase logout call, which should redirect the user to the homepage and handle the session clearing. Will also kill any extraneous auth sessions in the Supabase db that can mount up. See https://discord.com/channels/972416966683926538/1131130610753220619
    👍3
  • max.kayr-1276169629965750303

    Max

    1 year ago

    That is a good hint, thank you! Was not aware
    👍2
  • alexsiale_17363-1276250347064791063

    Alex

    1 year ago

    Oh nice! So we can the logout API and then redirect to the toddle/logout endpoint?
  • That’s great, I’ll test it
  • alexsiale_17363-1276254804557168761

    Alex

    1 year ago

    Worked!! 🙂
    🙌1
  • tomthebigtree-1276293447762051187

    Tom Ireland

    1 year ago

    Did that solve the issue then?
    ❤️1
  • alexsiale_17363-1276391730349871154

    Alex

    1 year ago

    Yes!
    🙌1