Login with username/email and password:
$ curl --silent -d '{"email":"user@example.com","password":"SUPERSECRETPASSWORD"}' -H "Content-Type: application/json" -X POST http://vue-spa-laravel-vue-spa.localhost/api/login | jq '.'
{
"token": "REDACTED",
"token_type": "bearer",
"expires_in": 86400
}
$ export TOKEN="REDACTED"
Now interact with API using that token:
$ curl --silent -H "Content-Type: application/json" -H "Authorization: Bearer ${TOKEN}" http://vue-spa-laravel-vue-spa.localhost/api/user | jq '.'
{
"id": 1,
"name": "Timo Goosen",
"email": "user@example.com",
"email_verified_at": null,
"created_at": "2022-09-01T14:29:46.000000Z",
"updated_at": "2022-09-01T14:29:46.000000Z",
"photo_url": "https://www.gravatar.com/avatar/fa0c70fe72300c0a07b49baa09c2f6dc.jpg?s=200&d=https%3A%2F%2Fui-avatars.com%2Fapi%2FTimo+Goosen"
}