Skip to content
loading...

Laravel Passport don`t work. Error: column "api_token" does not exist

github logo ・1 min read  

I want to create API with OAuth 2.0 authentication.

Use Laravel Passport tutorial https://laravel.com/docs/6.x/passport.

Set up the configuration on config/auth.php:

'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],

    'api' => [
        'driver' => 'passport',
        'provider' => 'users',
    ],
],

When testing, I use a fresh token, but in response I get an error:

SQLSTATE[42703]: Undefined column: 7 ERROR:  column "api_token" does not exist↵LINE 1: select * from "users" where "api_token" = $1 limit 1

Solution: clear the cache with command:

php artisan config:clear
twitter logo DISCUSS (2)
markdown guide
 
[deleted]
 

Laravel 6.x Passport does not require adding the api_token column to the users table, there is no need to create a migration with adding the api_token column.

Classic DEV Post from Sep 1 '19

Working as a freelancer

What is/was your experience working as a freelancer?

Pavel Olnyov profile image
I publish posts about Laravel and CMS Bitrix in order to share my experience.

Need dark mode?

Create your account (free forever) to customize your experience.

Get Started