Unfortunately, this project has been discontinued

JWT Auth Usage

Using the JWT Auth Guard

Middleware

In order to protect a certain route with the JWT Auth Guard, you need to specify auth:api as a middleware. Just like the example already present in your routes/api.php.

Creating tokens

You can create a token by attempting to login with user's credentials.

$token = Auth::attempt(['email' => '[email protected]', 'password' => 'secret']);

Checking for authentication

You can check whether the user is authenticated

if (Auth::check()) {
    //
}

or not

if (Auth::guest()) {
    //
}

Get Authenticated User

You can get the authenticated user

$user = Auth::user();

Explore the full documentation.