-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: API request with x-medusa-access-token header always returns Unauthorized #10691
Comments
I'm having kind of the same issue here. I'm following along the Medusa tutorial in the docs. I'm at the stage where a brand is add via curl. curl -X POST 'http://localhost:9000/admin/brands' |
you need to use only the token in the header, without " or {}.
|
Hello, can you specify exactly how you created this api key? |
The token should be passed like this
Intead of using @shahednasser not sure if this is documented well, I couldn't find info on how to use the secret API keys. I'll reassign to you so check it out when you can. |
It was generated through the Admin application by following these steps:
@sradevski Ah, I see the issue, I was following the v1 instructions at https://docs.medusajs.com/v1/api/admin. It would be great to have a warning message at the top of the page, if possible. I'll be mindful to use the v2 docs in the future. |
You should also update the OpenAPI specs, because they all use the v1 headers, still. I'd love a notification when that update takes place, I'll keep notifications for this thread on, in case it's possible to get a ping! |
Hey, we've updated it in the place it was used. Can you verify if there were other places it was used in? |
That's the only spot I found it, but if I see another I'll definitely ping ya! |
Package.json file
Node.js version
v20.10.0
Database and its version
PostgreSQL (default with npx create-medusa-app@latest on 12/17/24)
Operating system name and version
MacOS Sonoma 14.5 (23F79)
Browser name
Arc
What happended?
The API Keys that I generate via the Medusa Admin web app do not authorize my Admin API requests.
Expected behavior
❯ curl --request GET
--url http://localhost:9000/admin/custom
--header 'x-medusa-access-token: REDACTED' \
Should respond 200
Actual behavior
❯ curl --request GET
--url http://localhost:9000/admin/custom
--header 'x-medusa-access-token: REDACTED' \
{"message":"Unauthorized"}%
Link to reproduction repo
https://github.com/amunrarara/medusa-auth-header-bug
The text was updated successfully, but these errors were encountered: