PricingBlog

I get 401 Unauthorized error while invoking an API inspite of adding "Access bearer token"

  • prettycold_-1285277848189534208

    Sam B

    1 year ago

    I've done multiple pages that require authentication, but in the 3rd step or so, I get 401 error.

    The API as such works without any problems.

    The flow is : Login - > on success -> I set the access token from the login response and expire time to 3600.

    I have multiple pages (more like a multi step form), I set Bearer access token in all these pages. Page 1 and 2 do not have a problem, but the third one throws 401.

    If I turn off authentication on both front end and back end, it goes through.

    It seems very weird as there is nothing new in this page. Any help will be of great help 😉
  • lucasg-1285290248716423199

    Lucas G

    1 year ago

    If it is the same setup then perhaps it is an auth issue of where you are pulling the new data from, something like RLS perhaps
  • Otherwise hard to troubleshoot without taking a look
  • prettycold_-1285470957825294421

    Sam B

    1 year ago

    The only difference is, in this page I send an array of objects. In other pages, it was normal key-value pairs. Not sure whether that can cause problems. But then, without auth it went through which means the input variable should not be the cause. Hmm..

    It's a Bulk add record in the back end.