Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hex's avatar
Level 1

How to use Passport to secure API only routes with key and secret?

I have a read-only API that I want to secure with Passport, but I don't want Passport to be connected to any user in particular. I just want someone to be able to generate a secret and key and use that to get a token back, does that make sense? All the docs and tutorials I've seen are about how to do user auth with Passport but I am just wanting to add some "machine-to-machine" authentication for API routes.

The kind of thing that is described here https://www.oauth.com/oauth2-servers/client-registration/client-id-secret/

How would I go about doing this?

0 likes
1 reply

Please or to participate in this conversation.