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

API key support? #449

Open
hansemannn opened this issue Dec 6, 2024 · 6 comments
Open

API key support? #449

hansemannn opened this issue Dec 6, 2024 · 6 comments
Labels
question Further information is requested

Comments

@hansemannn
Copy link

Hi there!

Maybe I am overseeing it in the docs, but does this module support authenticating a request? For REST requests, API keys generated in Strapi admin can be set via the Authorization: Bearer XXX header, but I cannot find a util for that, yet.

Thanks a lot!

@hansemannn hansemannn added the question Further information is requested label Dec 6, 2024
@BayBreezy
Copy link
Contributor

Hey @hansemannn , If I understand correctly, you want to be able to attach your own api key that was generated in the strapi admin area?

@hansemannn
Copy link
Author

In general, I want to access APIs that require an API key, e.g. protected posts. While this is possible with their REST API, this wrapper is missing it so far IIRC. Thanks for checking this! 🏅

@BayBreezy
Copy link
Contributor

If you don't mind me asking, what is the current implementation that you have fro this type of functionality?

I am thinking a composable can be added for this type of thing BUT it sounds verify niche

@hansemannn
Copy link
Author

The current implementation is a Rest API call with an authentication header. It's necessary for any kind if non-public data that may leak if not properly secured.

But as we are quite happy with that approach, it's okay not to add it here.

@emiller12
Copy link

+1 to the OP

I fee like this is a must have feature as quite a few people are probably using Strapi as a CMS for a simple content site that doesn't require users to login, but they still want to protect their API using Strapi's API token feature.

https://docs.strapi.io/user-docs/settings/API-tokens

@azzagazz
Copy link

As far as i understand it the plugin does not support this because it would expose the token on the frontend since this is where it executes. But there still is a valid use case for making use of an api token, and that is for a catch-all read-access token (which could be exposed on the FE without issue). It saves you the hassle of having to select the find/findAll options each time you create a new content-type. As it stands now, if I want to use such a token, i have to make use of the REST API directly or set the respective r/o rights on the endpoints directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants