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

nunodonato's avatar

Multiple authentication types in the same API?

Hi all

I have an app with an API using the default token-based authentication that comes with Laravel (no sanctum/passport). Right now there's a need to add JWT support to it, but without replacing what already works. So basically I need the same routes to support two different authentication mechanisms.

Any tips or advice on how to proceed and pitfalls to avoid? thanks in advance.

0 likes
4 replies
nunodonato's avatar

@martinbean thanks, but won't that comma act as an AND? I want to use only one of guards, depending on the authentication mechanism selected

nunodonato's avatar

@martinbean Ah, I thought it would check require all guards to pass when defined like that. Thanks again!

1 like

Please or to participate in this conversation.