Easy way to test an API token programatically?

What would be the best way to check an API token? Currently im doing const testResponse = await fetch(`${strapiURL}/api/global`, { method: "GET", headers, }); but ive noticed when the global route is not published, this fails as a 404, so doesn’t let me test my token.

This topic has been created from a Discord post (1299391847575322654) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

There isn’t really any default endpoint you can use to test if an API token is valid or not, user JWTs you can use the /me route to get the users data but API tokens have nothing really.

ah okay, that’s fair thanks

I suppose best case would be to create a custom endpoint/controller that does something basic like validate the token and give a generic response

You could build one pretty quickly in about 5 minutes or so if you really needed one

yeah may be worth doing