diff --git a/app/Http/Livewire/OauthClients.php b/app/Http/Livewire/OauthClients.php
index 39813a50d7..0f7d130e91 100644
--- a/app/Http/Livewire/OauthClients.php
+++ b/app/Http/Livewire/OauthClients.php
@@ -2,9 +2,11 @@
namespace App\Http\Livewire;
+use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Laravel\Passport\Client;
use Laravel\Passport\ClientRepository;
+use Laravel\Passport\TokenRepository;
use Livewire\Component;
class OauthClients extends Component
@@ -18,10 +20,12 @@ class OauthClients extends Component
public $authorizationError;
protected $clientRepository;
+ protected $tokenRepository;
public function __construct()
{
$this->clientRepository = app(ClientRepository::class);
+ $this->tokenRepository = app(TokenRepository::class);
parent::__construct();
}
@@ -29,6 +33,7 @@ class OauthClients extends Component
{
return view('livewire.oauth-clients', [
'clients' => $this->clientRepository->activeForUser(auth()->user()->id),
+ 'authorized_tokens' => $this->tokenRepository->forUser(auth()->user()->id)->where('revoked', false),
]);
}
@@ -60,6 +65,17 @@ class OauthClients extends Component
}
}
+ public function deleteToken($tokenId): void
+ {
+ $token = $this->tokenRepository->find($tokenId);
+ if ($token->user_id == auth()->user()->id) {
+ $this->tokenRepository->revokeAccessToken($tokenId);
+ } else {
+ Log::warning('User ' . auth()->user()->id . ' attempted to delete token ' . $tokenId . ' which belongs to user ' . $token->user_id);
+ $this->authorizationError = 'You are not authorized to delete this token.';
+ }
+ }
+
public function editClient(Client $editClientId): void
{
$this->editName = $editClientId->name;
diff --git a/resources/assets/js/components/passport/AuthorizedClients.vue b/resources/assets/js/components/passport/AuthorizedClients.vue
deleted file mode 100644
index f6bd92dbd8..0000000000
--- a/resources/assets/js/components/passport/AuthorizedClients.vue
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-
- Authorized Applications
-
-
-
-
-
-
-
-
-
- Name
- Scopes
- Delete
-
-
-
-
-
- {{ token.client.name }}
-
-
-
-
-
- {{ token.scopes.join(', ') }}
-
-
-
-
-
-
- Revoke
-
-
-
Name | +Scopes | +Delete | +
---|---|---|
+ {{ $token->client->name }} + | + + ++ @if(!$token->scopes) + No Scopes + @endif + | + + ++ + + + | +
{{ trans('general.feature_disabled') }}
diff --git a/resources/views/vendor/passport/authorize.blade.php b/resources/views/vendor/passport/authorize.blade.php index 8565c2d24b..cdf3285298 100644 --- a/resources/views/vendor/passport/authorize.blade.php +++ b/resources/views/vendor/passport/authorize.blade.php @@ -9,7 +9,7 @@