Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

julianov's avatar

Error migrating from sanctum to passport

Hello Im having this error response:

"SQLSTATE[42P01]: Undefined table: 7 ERROR: no existe la relación «oauth_personal_access_clients» LINE 1: select exists(select * from "oauth_personal_access_clients")... ^ (SQL: select exists(select * from "oauth_personal_access_clients") as "exists")"

This error apears when I change from sanctum to passport.

This is the function that gives the error.

public function validate_new_cars(Request $request)
{
    $validated = $this->validate($request, [
        'name' => 'required',
        'confirmation_code' => 'required',
    ]);


    $cars = Cars::where('name', $validated['name'] )->first();


    if ($cars['confirmation_code']==$validated['confirmation_code']){
         
        $cars->markEmailAsVerified();
        $cars->save();
        return response()->json([
            'status' => true,
            'message' => 'cars confirmde',
            'token' => $cars->createToken("token_cars")->plainTextToken
        ], 200);

    }else{

        return response()->json([
            'status' => false,
            'message' => 'bad code'
        ], 400);

    }
}
0 likes
2 replies
MohamedTammam's avatar
Level 51

You need to run

php artisan migrate
php artisan passport:install
php artisan passport:keys
1 like

Please or to participate in this conversation.