PlaylistPolicy::class, User::class => UserPolicy::class, ]; /** * Register any application authentication / authorization services. */ public function boot(): void { $this->registerPolicies(); Auth::viaRequest('token-via-query-parameter', static function (Request $request): ?User { /** @var TokenManager $tokenManager */ $tokenManager = app(TokenManager::class); return $tokenManager->getUserFromPlainTextToken($request->api_token ?: ''); }); } }