From f3b9a435e302b1a3d9a50285e934a6be66b2754a Mon Sep 17 00:00:00 2001 From: guillaumeboussion <91058384+guillaumeboussion@users.noreply.github.com> Date: Sat, 11 Feb 2023 05:00:50 +0100 Subject: [PATCH] [Apple] Adding method to return SocialiteUser by JWT token (#962) --- Provider.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Provider.php b/Provider.php index 625ea8a..7a78ac5 100644 --- a/Provider.php +++ b/Provider.php @@ -117,6 +117,23 @@ protected function getUserByToken($token) return json_decode(base64_decode($claims), true); } + /** + * Return the user given the identity token provided on the client + * side by Apple. + * + * @param string $token + * + * @throws InvalidStateException when token can't be parsed + * + * @return User $user + */ + public function userByIdentityToken(string $token): SocialiteUser + { + $array = $this->getUserByToken($token); + + return $this->mapUserToObject($array); + } + /** * Verify Apple jwt. *