Make user id attribute for social network authentification configurable

This commit is contained in:
Elias Luhr
2024-01-05 14:56:15 +01:00
parent d6c0c8e722
commit a7e044febf
3 changed files with 10 additions and 4 deletions

View File

@ -14,8 +14,9 @@ namespace Da\User\Contracts;
use yii\authclient\ClientInterface;
/**
* @property-read string $email
* @property-read string $username
* @property-read string|null $email
* @property-read string|null $userName
* @property-read mixed|null $userId
*/
interface AuthClientInterface extends ClientInterface
{
@ -28,4 +29,9 @@ interface AuthClientInterface extends ClientInterface
* @return string|null username
*/
public function getUserName();
/**
* @return mixed|null user id
*/
public function getUserId();
}

View File

@ -83,7 +83,7 @@ class SocialNetworkAccountConnectService implements ServiceInterface
[],
[
'provider' => $this->client->getId(),
'client_id' => $data['id'],
'client_id' => $this->client->getUserId(),
'data' => json_encode($data),
]
);

View File

@ -97,7 +97,7 @@ class SocialNetworkAuthenticateService implements ServiceInterface
[],
[
'provider' => $this->client->getId(),
'client_id' => $data['id'],
'client_id' => $this->client->getUserId(),
'data' => json_encode($data),
'username' => $this->client->getUserName(),
'email' => $this->client->getEmail(),