vendredi 9 août 2019

How to authenticate user base on JWT API - Laravel 5.8?

enter image description here

I'm using PHP 7.2 on Laravel 5.8. I current use Auth provider that came with Laravel to log my users in. It currently check if the email, and password match in the database configured.

I did this

$dbAuth = Auth::attempt(array(
    'email' => $email,
    'password' => $password
));

if ($dbAuth) {

    return Redirect::to('/dashboard')->with('success', 'You have been successfully logged in.');

} else {
    return Redirect::to('/')->with('error', 'Username/Password Wrong')->with('email', $email)->withErrors($validator);
} 

I can't do that anymore, I have to talk to call an API that return a token.


Just to clarify :

My main goal is to call JWT API, and logged my user in if I got the 200 response.


How do log my users in now?

Is there a tutorial that you guys recommend?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire