julianov's avatar

Scope is invalid, unknown, or malformed

Hello everyone. I am getting the following error:

"The requested scope is invalid, unknown, or malformed"

The problem occurs in a user who must have scope level_4. This scope, I added it last. That is, I recently added that scope (level_4) while the others are older and they work perfectly.

Is there a step I'm skipping? This is the code for AuthServiceProvider.php

<?php

namespace App\Providers;

// use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Laravel\Passport\Passport;

class AuthServiceProvider extends ServiceProvider
{
	/**
	 * The model to policy mappings for the application.
	 *
	 * @var array<class-string, class-string>
	 */
	protected $policies = [
		// 'App\Models\Model' => 'App\Policies\ModelPolicy',


	];

	/**
	 * Register any authentication / authorization services.
	 *
	 * @return void
	 */
	public function boot()
	{
		$this->registerPolicies();

		Passport::tokensExpireIn(now()->addDays(1));
		Passport::personalAccessTokensExpireIn(now()->addDays(1));

		Passport::tokensCan([
			'level_1' => 'basic',
			'level_2' => 'personal data',
			'level_3' => 'app',
			'level_4' => 'destock',
		]);


	}
}
0 likes
0 replies

Please or to participate in this conversation.