diff --git a/src/Appwrite/Auth/OAuth2/Authentik.php b/src/Appwrite/Auth/OAuth2/Authentik.php index b4c6d1cfbd..6ef701fc32 100644 --- a/src/Appwrite/Auth/OAuth2/Authentik.php +++ b/src/Appwrite/Auth/OAuth2/Authentik.php @@ -9,10 +9,10 @@ use Appwrite\Auth\OAuth2; class Authentik extends OAuth2 { - /** + /** * @var array */ - protected $scopes = [ + protected array $scopes = [ 'openid', 'profile', 'email', @@ -22,12 +22,12 @@ class Authentik extends OAuth2 /** * @var array */ - protected $user = []; + protected array $user = []; /** * @var array */ - protected $tokens = []; + protected array $tokens = []; /** * @return string @@ -137,6 +137,25 @@ class Authentik extends OAuth2 return ''; } + /** + * Check if the User email is verified + * + * + * @param string $accessToken + * + * @return bool + */ + public function isEmailVerified(string $accessToken): bool + { + $user = $this->getUser($accessToken); + + if ($user['email_verified'] ?? false) { + return true; + } + + return false; + } + /** * @param string $accessToken *