I am using Laravel's JWT plugin for user login/authentication. This works fine for my users table: when he specifically registers into my website, entering a password, email etc.
In the jwt, i am checking for email(which is unique) and password.
I would like to also implement the Laravel's socialite plugin, to enable login using google/facebook etc, using oauth2 .
Could anybody tell me how to use both ?
I have set an authentication middleware , that checks for the authentication token(generated by JWT plugin). But I am not sure how that will work if I login using g+ etc
If you are using JWTAuth https://github.com/tymondesigns/jwt-auth , it also supports Socialite login. After Socialite returns an authenticated user, you can lookup the DB by email or create if not exists. Then you can generate token using
$token = JWTAuth::fromUser($user)
More discussions can be found at this link https://laracasts.com/discuss/channels/laravel/how-would-one-use-jwt-json-web-tokens-with-laravel-socialite
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With