mariovalney / laravel-keycloak-web-guard

Simple Keycloak Guard to Laravel Web Routes - https://packagist.org/packages/vizir/laravel-keycloak-web-guard
146 stars 80 forks source link

What is best way to save data of the first time user authenticates? #54

Closed sachinuthale closed 2 years ago

sachinuthale commented 3 years ago

Hello,

I am using my own model with driver: keycloak-users, What is best way to save the name and email of the first time log in user to the application db ??

Currently i am able to save to the table, but i want to know is their any best way to do in service provider ??

mariovalney commented 3 years ago

Hi.

I'm not sure what you are trying to achieve. But you can use DB facade to save data to another table in laravel.

sachinuthale commented 3 years ago

Hello,

Thank you for response :).

In my application user needs to create a team, so user creating a team using email id. So i am just need to check the user coming from keycloak is already in my db or not ?? if already in db can go further, else need to add that user to table.

Currently i have written the middleware, which will check the email is present or not, if not insert and done.

mariovalney commented 2 years ago

I guess that's a good solution. Do you need more help?

sachinuthale commented 2 years ago

No Sir, Thank you for response.

Mentioned solution works fine for me.