GriffinLedingham / php-apple-signin

🗝 Decode Apple Sign In client tokens in PHP
BSD 3-Clause "New" or "Revised" License
200 stars 87 forks source link

Type error: Return value of AppleSignIn\ASDecoder::decodeIdentityToken() must be an instance of AppleSignIn\object, instance of stdClass returned #9

Open huaidan9527 opened 4 years ago

huaidan9527 commented 4 years ago

Type error: Return value of AppleSignIn\ASDecoder::decodeIdentityToken() must be an instance of AppleSignIn\object, instance of stdClass returned

mcchrish commented 4 years ago

Same. Happens in php version 7.1 for me.

yanlong-li commented 4 years ago

Code cannot be less than php7.2 You can consider upgrading your PHP version

yosus commented 4 years ago

Those on older PHP version can use a simpler function as below in "ASDecoder.php" . I used it on PHP 7.0 It will return an array instead of the object.

public static function getAppleSignInArray(string $identityToken) 
{

    $identityPayload =  self::decodeIdentityToken($identityToken);
return (array) $identityPayload;
}
djunior97 commented 3 years ago

Those on older PHP version can use a simpler function as below in "ASDecoder.php" . I used it on PHP 7.0 It will return an array instead of the object.

public static function getAppleSignInArray(string $identityToken) 
{

    $identityPayload =  self::decodeIdentityToken($identityToken);
return (array) $identityPayload;
}

This function does not exists inside ASDecodes.php, did I get it wrong?

Can't get it to work on PHP 7.1

sn01615 commented 3 years ago

Hope support php7.1.