S
S
spaceatmoon2021-10-20 13:22:37
Laravel
spaceatmoon, 2021-10-20 13:22:37

Why doesn't it return a token?

I follow the guide https://www.tutsmake.com/laravel-8-rest-api-authen...

Returns this instead of a token

{
    "token": {
        "name": "Laravel8PassportAuth",
        "abilities": [
            "*"
        ],
        "tokenable_id": 4,
        "tokenable_type": "App\\Models\\User",
        "updated_at": "2021-10-20T10:20:03.000000Z",
        "created_at": "2021-10-20T10:20:03.000000Z",
        "id": 22
    }
}


What is the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
spaceatmoon, 2021-10-20
@spaceatmoon

Found an error. An invalid package was specified for the HasApiTokens trait.
use Laravel\Sanctum\HasApiTokens;
And it should be like this
use Laravel\Passport\HasApiTokens;
https://stackoverflow.com/a/69561615/17078920

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question