diff --git a/resources/views/authorize.blade.php b/resources/views/authorize.blade.php
index ecbdcaa58..d0a4a991c 100644
--- a/resources/views/authorize.blade.php
+++ b/resources/views/authorize.blade.php
@@ -68,7 +68,7 @@
@csrf
-
+
@@ -79,7 +79,7 @@
@method('DELETE')
-
+
diff --git a/src/ClientRepository.php b/src/ClientRepository.php
index aebe33b11..402deb057 100644
--- a/src/ClientRepository.php
+++ b/src/ClientRepository.php
@@ -167,7 +167,7 @@ public function createPersonalAccessClient($userId, $name, $redirect)
{
return tap($this->create($userId, $name, $redirect, null, true), function ($client) {
$accessClient = Passport::personalAccessClient();
- $accessClient->client_id = $client->id;
+ $accessClient->client_id = $client->getKey();
$accessClient->save();
});
}
diff --git a/src/Console/ClientCommand.php b/src/Console/ClientCommand.php
index 15f2f9227..c46f63bc6 100644
--- a/src/Console/ClientCommand.php
+++ b/src/Console/ClientCommand.php
@@ -167,7 +167,7 @@ protected function outputClientDetails(Client $client)
$this->line('');
}
- $this->line('Client ID: '.$client->id);
+ $this->line('Client ID: '.$client->getKey());
$this->line('Client secret: '.$client->plainSecret);
}
}
diff --git a/src/Passport.php b/src/Passport.php
index 6e577ebea..eb85e0a81 100644
--- a/src/Passport.php
+++ b/src/Passport.php
@@ -370,7 +370,7 @@ public static function actingAsClient($client, $scopes = [], $guard = 'api')
{
$token = app(self::tokenModel());
- $token->client_id = $client->id;
+ $token->client_id = $client->getKey();
$token->setRelation('client', $client);
$token->scopes = $scopes;
diff --git a/src/PersonalAccessTokenFactory.php b/src/PersonalAccessTokenFactory.php
index 65817a7a1..15ac840ad 100644
--- a/src/PersonalAccessTokenFactory.php
+++ b/src/PersonalAccessTokenFactory.php
@@ -98,7 +98,7 @@ protected function createRequest($client, $userId, array $scopes)
return (new ServerRequest('POST', 'not-important'))->withParsedBody([
'grant_type' => 'personal_access',
- 'client_id' => $client->id,
+ 'client_id' => $client->getKey(),
'client_secret' => $secret,
'user_id' => $userId,
'scope' => implode(' ', $scopes),
diff --git a/tests/Feature/AccessTokenControllerTest.php b/tests/Feature/AccessTokenControllerTest.php
index 073f65d62..54cb4ffd9 100644
--- a/tests/Feature/AccessTokenControllerTest.php
+++ b/tests/Feature/AccessTokenControllerTest.php
@@ -50,13 +50,13 @@ public function testGettingAccessTokenWithClientCredentialsGrant()
$user->save();
/** @var Client $client */
- $client = ClientFactory::new()->asClientCredentials()->create(['user_id' => $user->id]);
+ $client = ClientFactory::new()->asClientCredentials()->create(['user_id' => $user->getKey()]);
$response = $this->post(
'/oauth/token',
[
'grant_type' => 'client_credentials',
- 'client_id' => $client->id,
+ 'client_id' => $client->getKey(),
'client_secret' => $client->secret,
]
);
@@ -93,13 +93,13 @@ public function testGettingAccessTokenWithClientCredentialsGrantInvalidClientSec
$user->save();
/** @var Client $client */
- $client = ClientFactory::new()->asClientCredentials()->create(['user_id' => $user->id]);
+ $client = ClientFactory::new()->asClientCredentials()->create(['user_id' => $user->getKey()]);
$response = $this->post(
'/oauth/token',
[
'grant_type' => 'client_credentials',
- 'client_id' => $client->id,
+ 'client_id' => $client->getKey(),
'client_secret' => $client->secret.'foo',
]
);
@@ -137,13 +137,13 @@ public function testGettingAccessTokenWithPasswordGrant()
$user->save();
/** @var Client $client */
- $client = ClientFactory::new()->asPasswordClient()->create(['user_id' => $user->id]);
+ $client = ClientFactory::new()->asPasswordClient()->create(['user_id' => $user->getKey()]);
$response = $this->post(
'/oauth/token',
[
'grant_type' => 'password',
- 'client_id' => $client->id,
+ 'client_id' => $client->getKey(),
'client_secret' => $client->secret,
'username' => $user->email,
'password' => $password,
@@ -184,13 +184,13 @@ public function testGettingAccessTokenWithPasswordGrantWithInvalidPassword()
$user->save();
/** @var Client $client */
- $client = ClientFactory::new()->asPasswordClient()->create(['user_id' => $user->id]);
+ $client = ClientFactory::new()->asPasswordClient()->create(['user_id' => $user->getKey()]);
$response = $this->post(
'/oauth/token',
[
'grant_type' => 'password',
- 'client_id' => $client->id,
+ 'client_id' => $client->getKey(),
'client_secret' => $client->secret,
'username' => $user->email,
'password' => $password.'foo',
@@ -227,13 +227,13 @@ public function testGettingAccessTokenWithPasswordGrantWithInvalidClientSecret()
$user->save();
/** @var Client $client */
- $client = ClientFactory::new()->asPasswordClient()->create(['user_id' => $user->id]);
+ $client = ClientFactory::new()->asPasswordClient()->create(['user_id' => $user->getKey()]);
$response = $this->post(
'/oauth/token',
[
'grant_type' => 'password',
- 'client_id' => $client->id,
+ 'client_id' => $client->getKey(),
'client_secret' => $client->secret.'foo',
'username' => $user->email,
'password' => $password,
@@ -274,13 +274,13 @@ public function testGettingCustomResponseType()
$user->save();
/** @var Client $client */
- $client = ClientFactory::new()->asClientCredentials()->create(['user_id' => $user->id]);
+ $client = ClientFactory::new()->asClientCredentials()->create(['user_id' => $user->getKey()]);
$response = $this->post(
'/oauth/token',
[
'grant_type' => 'client_credentials',
- 'client_id' => $client->id,
+ 'client_id' => $client->getKey(),
'client_secret' => $client->secret,
]
);
diff --git a/tests/Unit/PersonalAccessTokenFactoryTest.php b/tests/Unit/PersonalAccessTokenFactoryTest.php
index f4731bd6b..33e576465 100644
--- a/tests/Unit/PersonalAccessTokenFactoryTest.php
+++ b/tests/Unit/PersonalAccessTokenFactoryTest.php
@@ -2,6 +2,7 @@
namespace Laravel\Passport\Tests\Unit;
+use Laravel\Passport\Client;
use Laravel\Passport\ClientRepository;
use Laravel\Passport\PersonalAccessTokenFactory;
use Laravel\Passport\PersonalAccessTokenResult;
@@ -56,7 +57,7 @@ public function test_access_token_can_be_created()
}
}
-class PersonalAccessTokenFactoryTestClientStub
+class PersonalAccessTokenFactoryTestClientStub extends Client
{
public $id = 1;