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

ONDERSAHIN's avatar

How can I create HashiCorp Login Mechanism with persist DB Session on Laravel ?

I try to create a login mechanism with HashiCorp Vault so what I had did list in below :

0 - I have create a custom Session Handler 1 - I have create a custom User Provider 2 - I have create a custom Authenticable Model 3- I have create a custom AuthUserProvider Service

Laravel App does not have Users table.I authenticate on Vault and it responses me with token and other information like user name ,session expired time etc. I calculate this on my Custom User Provider in validateCredentials method and try to keep this returned user_name on Laravel Sessions table persistly.Because I try to use Auth facade to check current user in my app.On the other hand , I changed my session table , user_id to user_name,integer => string data field Here in my observation :

I calculate this auth succesfully but my session handler called two times.I can not store user_name on my sessions table with current active session.

Can you help me about this problem?Thank you :)

0 likes
0 replies

Please or to participate in this conversation.