Exposing route to public users to use JWT

System Information
  • Strapi Version: 4
  • Operating System: Mac
  • Database: MySQL
  • Node Version: 16
  • Yarn Version: 1.22

Im trying to expose a route for external users to use my api however they want. I would provide my users with api keys that they can use to call the api and validate using JWT. However Im a bit unsure as to how I can expose a route to the public. I’ve tried creating a plugin however I didn’t have much luck with it. Can someone offer some suggestions?

You don’t need a plugin, You can create a content-type for custom-api-keys and then create a controller with a middleware/ policy that validates the apiKey the user sends in their headers or however they send it.

You can also use JWT, around certain parameters (But you might not be able to disable access of the token) by will until it expires.