Skip to content
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

Docs(Code Issue): Code Issue in /modules/products/admin/import-products #6264

Closed
2 tasks done
irab opened this issue Jan 30, 2024 · 2 comments
Closed
2 tasks done

Docs(Code Issue): Code Issue in /modules/products/admin/import-products #6264

irab opened this issue Jan 30, 2024 · 2 comments

Comments

@irab
Copy link
Contributor

irab commented Jan 30, 2024

Preliminary Checks

Issue Summary

Using latest Admin package release version: "@medusajs/admin": "7.1.10"

The current cURL doco for importing products specifies the API Token is provided with -H 'Authorization: Bearer <API_TOKEN>' but calls made with this header fail with an Unauthorized response.

Calling the API with the following cURL header option works: -H 'x-medusa-access-token: <API_TOKEN>'

I can possibly raise a PR to fix the documentation if I get confirmation that this is the correct approach?

How can this issue be resolved?

The API doco for cURL commands are updated to -H 'x-medusa-access-token: <API_TOKEN>' wherever -H 'Authorization: Bearer <API_TOKEN>' occurs.

Are you interested in working on this issue?

  • I would like to fix this issue
@shahednasser
Copy link
Member

Thank you for opening this issue! That's true, it should be -H 'x-medusa-access-token: <API_TOKEN>'. I think this is a change we missed to make in the main docs but have made in the API reference.

Would you be up to make the change in all files under www/apps/docs/content as this is probably used in different places? It should be a quick find-and-replace

@irab
Copy link
Contributor Author

irab commented Jan 30, 2024

Yes, happy to ❤️

Will raise a PR in a bit.

kodiakhq bot pushed a commit that referenced this issue Feb 7, 2024
…sa-access-token header (#6326)

## What

This is to update incorrect documentation in regards to authentication to the Admin API - raised in #6264.

## Why

Because the current documentation has been incorrect since the September 2023 release of [v1.17.0](https://github.com/medusajs/medusa/releases/tag/v1.17.0), which had breaking changes to API token usage.

## How

Simple search and replace. I was asked to replace occurrences under `www/apps/docs/content/` but there were also additional places where I thought references should also be updated:

- `packages/medusa/src/api/`
- `www/apps/api-reference/`

Feel free to revert them as needed.

There is also some inconsistency between the format shown in examples e.g. `<API_TOKEN>` vs `{api_token}` vs `{access_token}`.

I have kept the format the same in all cases as the original, as surrounding documentation text would not have format updated as well. I suggest maybe reviewing the documentation and keeping to a consistent format e.g. `<API_TOKEN>`.

 
## Testing 

I have not tested these changes. I would assume the `packages/medusa/src/api/` changes may need more thorough testing?
@irab irab closed this as completed May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants