Help forum

Not being able to use Bearer access_token after login with Supabase

  • roccons

    2 years ago

    I already have a succesuful login and I'm getting my Bearer access_token within the response data, but I'm not being suceessful at saving it as a Session cookie so when I try to use it in another API request using Bearer access_token for Authentication I get a 401 error with the message "This endpoint requires a Bearer token". What I am missing?
    I attach some images of the configuration of my two API requests.
    1266105572319563838-Screenshot_from_2024-07-25_12-43-13.png
    1266105572596645960-Screenshot_from_2024-07-25_12-43-45.png
    1266105572969812059-Screenshot_from_2024-07-25_12-50-23.png
  • Lucas G

    2 years ago

    Start with the basic checks:
    Are you logging in on the preview site instead of the editor?
    Is the toddle extension installed?
  • roccons

    2 years ago

    Thanks Lucas. I have the extension installed. With preview site you mean the toddle.site in another browser tab?
  • roccons

    2 years ago

    I've tried both login with the preview mode within the editor, and in the preview site. But I'm checking the request for the list users endpoint only inside the editor because I've not added it to the UI yet.
  • roccons

    2 years ago

    Oh but I see the extension is disabled in my editor tab, I had the idea that the extension was active inside the editor. Is that the problem?
    ✅1
  • roccons

    2 years ago

    If that's the case how could I use authenticated requests within the editor?
  • roccons

    2 years ago

    Also, I can't access the data child nodes of the response if I can't use the authentication inside the editor
  • roccons

    2 years ago

    I've also checked that the values I insert in the preview site aren't passed to the editor, no matter the extension is active in the preview tab.
  • roccons

    2 years ago

    I already tried in different ways but I keep getting the 401 "This endpoint require a Bearer token"
  • Tod

    2 years ago

    Great energy @roccons! Your continuous contribution to the toddle Community just made you advance to Community Level 4!
  • roccons

    2 years ago

    I can also confirm that if I make the request in Postman, using the acces_token I get in toddle, the request works just fine
  • Lucas G

    2 years ago

    You open up the preview site (toddle.site) and login in there
  • Once you do that, you refresh the editor and the extension handles the token access
  • This is the way to do it for now until the new extension comes along
  • roccons

    2 years ago

    it worked, thanks!!
    👍1