Refresh token

Refresh token is called when the token has expired based on the expiry time. In order to refresh the token, we also need to add the following route:

$api->patch(    '/', [        'uses' => 'Auth/AuthController@refreshToken',        'as' => 'api.auth.refresh'    ]);

Note that all these endpoints will be added under version v1.

Once we have this AuthController there and routes are set up, the user can log in using the following endpoint:

POST /api/v1/auth/loginParams: email, passsword

Try this and you will get a JWT-based access token.

Lumen, Dingo, JWT Auth, and CORS boilerplate: If you face difficulty in configuring Lumen with Dingo and JWT, then you can simply use the repository at https://github.com/krisanalfa/lumen-jwt. This repository will ...

Get Building RESTful Web Services with PHP 7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.