- clone o repositório
- copie o .env.example para .env
- rode: composer install
- rode: php artisan serve
- cd frontend
- npm install
- npm run serve
Rode:
php artisan serve
Acesse:
http://127.0.0.1:8000/docs/api
Pacote utilizado: https://jwt-auth.readthedocs.io/en/develop/
I have included a helper command to generate a key for you:
php artisan jwt:secret
This will update your .env
file with something like JWT_SECRET=foobar
It is the key that will be used to sign your tokens. How that happens exactly will depend on the algorithm that you choose to use.
There are a number of ways to send the token via http:
Authorization: Bearer eyJhbGciOiJIUzI1NiI...
http://example.dev/me?token=eyJhbGciOiJIUzI1NiI...
Get the raw JWT payload
$payload = auth()->payload();
// then you can access the claims directly e.g.
$payload->get('sub'); // = 123
$payload['jti']; // = 'asfe4fq434asdf'
$payload('exp') // = 123456
$payload->toArray(); // = ['sub' => 123, 'exp' => 123456, 'jti' => 'asfe4fq434asdf'] etc