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

Lox_'s avatar
Level 1

Sanctum/breeze SPA, add OpenID Connect

Hello,

I have a running Vue SPA with a Laravel breeze/sanctum backend. Everything works fine. I need to add another way to authenticate. It is an OpenID Connect (keyclock compatible) auth provider.

I have seen packages for Keycloak. Some use a JWT token, which I don't want.

I need the user to authenticate using OpenID Connect and then get logged and use a normal sanctum session.

Does anyone know a package that could handle that ?

0 likes
7 replies
jlrdw's avatar

I wonder if passport would be a better choice? If not using a native mobile app you might not need OpenID Connect.

You mention a normal session, is it an API or web app.

Lox_'s avatar
Level 1

@jlrdw isn't it an external auth service ? If so, it is not an option to rely on a third party service.

I need the user to be able to register using the auth provider, putting it's auth id from the auth provider into a database field on callback. Then when logging with the provider, on callback, the database field is checked and the user get authenticated using normal session.

All that while still supporting password auth.

jlrdw's avatar

@Lox_

and the user get authenticated using normal session.

Why do you need oauth2 when authenticated using normal session

An API would make sure credentials match and assign a token for use.

Sorry if I am not understanding your setup. But using normal session just sounds like a normal web app and not an API.

You read this:

In order to authenticate, your SPA and API must share the same top-level domain. However, they may be placed on different subdomains. Additionally, you should ensure that you send the Accept: application/json header and either the Referer or Origin header with your request.

You use cookies yes, but I still don't understand why you also want the oauth2.

You have to follow the SPA part of the documentation.

Lox_'s avatar
Level 1

@jlrdw I already have my Vue PWA running and have User/Password authentication using Breeze, so, sessions. I based my work on this : github.com/faisalfjri/breeze-vue-api

I just want to add another way to login/register using a third party OID Connect identity provider.

jlrdw's avatar

@Lox_ I see examples with Passport. See if you can find examples with Sanctum. Or seek another alternative for Sanctum.

Lox_'s avatar
Level 1

I managed to achieve my goal using Socialite and by developing my own connector. Thanks

Please or to participate in this conversation.