Open tunglh-asilla opened 8 months ago
Try this:
Authorization: Bearer ${(await fetchAuthSession())?.tokens?.accessToken}
It worked for me.
It took me awhile to find this in the webs. The docs page and tutorials definitely needs to be updated, the "copy" code is incorrect.
"I've been working on setting up admin actions in my React app for the past few days. I used some example code from the documentation, but I'm getting a CORS error. I tried testing a method from API Gateway, but I'm getting a 401 unauthorized error. Can you suggest how I can solve these issues?"
The doc hasn't been updated yet, took me a whole day to find this chat after so much searching, deleting, and recreating the AdminQueries and this was the only issue and it worked after updating to:
Authorization: Bearer ${(await fetchAuthSession())?.tokens?.accessToken}
Thanks, guys
In this doc https://docs.amplify.aws/javascript/build-a-backend/auth/admin-actions/, the guide shows that calling API as below:
But I think it missed
Bearer
keyword, specificallyAnd, please add tutorial to change auth function role from local env