Rest API (POST) not sending credentials

Hi,

I am having an issue posting to a Xano endpoint when authorization is required. I removed authorization from the API endpoint and unchecked Send credentials in weweb and was able to get the request to work. I tried turning on authorization in Xano and leaving Send Credentials uncheck and I got Error code 401 (which is good!). When I check send credentials I am left with the following error.

My test user is signed in and has an auth token as you can see. I relooked at the Xano Auth plugin and everything is green and setup correctly. Not really sure how to approach fixing this.

I’ve tested my Xano endpoint in Xano by removing all fields from the test post and the endpoint accepts it.

Are you sending the user bearer token through the requests headers?

Yes I tried that on the first go around by binding Key: accessToken with a value of the Xano auth plugin [‘accessToken’] but was still receiving the same error.

Send credentials is only required if you need to have third party cookies sent with your request. For a header containing your token you don’t have to check this option.

Ok. I think im narrowing down my issue here. I updated the workflow to not send credentials. I logged the user out and logged back in. I am now getting a 401 error and I can see that the accessToken being sent by weweb does not match this users access token in Xano.

edit: but when i copy the weweb access token and use it directly in Xano i get a successful post :melting_face:

I figured out the solution.

I was passing the wrong key value for the auth token. According to Xano’s docs: https://docs.xano.com/api/the-basics/authenticated-request I needed to pass my token under the key “Authorization”. I changed my workflow and it worked :slight_smile:

2 Likes