HTTP Cookie Bug

  • 0xJam3s

    1 month ago

    Hey guys, it seems my bearer token is saving but when I get the HTTP cookie it doesn't get pass the value to the my following api calls. It was working earlier. Any ideas, why this might be?
  • @NoCode ProCode I am uisng an edge function
  • Erik Beuschau

    1 month ago

    If you set the cookie using the set session cookie action in toddle, the cookie will be a same site cookie. Therefore, you need to make sure you proxy your API request through toddle’s backend. Check under “advanced” on your API call
  • 0xJam3s

    1 month ago

    Thanks @Erik Beuschau - I do have the proxy setting enabled on the advanced tab
  • Erik Beuschau

    1 month ago

    I see. It’s a bit tricky to debug without more details. Perhaps you could send me instructions on how to reproduce? If the project is public, you can just send me the link to your project 🤞
  • 0xJam3s

    1 month ago

    I have sent you a link to the project in a DM mate, thanks! @Erik Beuschau
  • codenitrr

    1 month ago

    I have also struggled with this several times. I was able to solve it by reinstalling the Toddle Chrome plugin. No idea if it helps with you too, but thought I'd mention it
    👍1
  • 0xJam3s

    1 month ago

    Thanks @ - yesterday I did do that and it fixed my issue. Not this time though, and it's not working on the staging site either
  • Lucas G

    1 month ago

    The extension will only affect the editor having access to the cookie
  • The actual call should have it regardless as long as the proxy is turned on
  • 0xJam3s

    1 month ago

    When I check network in log

    I see:

    authorization:
    Bearer {{ cookies.access_token }}
    content-type:
    application/json
    cookie:
    access_token=eyJhbGciOiJIUzI1NiIsImtpZCI6Ikd3cmhRV1ZMSitYWFZLNysiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FhaHRuZ29tb3BzZmFudHN4ZXR0


    Why does the cookie exist there? Surely it defeats the point i the {{ cookies.access_token }}?
  • Lucas G

    1 month ago

    Assuming the cookie was correctly set/is not expired
  • Lucas G

    1 month ago

    The network log will show the placeholder
  • 0xJam3s

    1 month ago

    But it includes also

    cookie:
    access_token=eyJhbGciOiJIUzI1NiIsImtpZCI6Ikd3cmhRV1ZMSitYWFZLNysiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FhaHRuZ29tb3BzZmFudHN4ZXR0...
  • Lucas G

    1 month ago

    The call will have it correctly on the backend
  • 0xJam3s

    1 month ago

    All sorted thanks to Eric. I was running GO TO URL at the same time as updating the access token. I should have been updating the access token on success of the event. Thanks guys
    🙌3

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.