Apple登录返回无效授权

时间:2020-06-25 12:17:14

标签: laravel

我正在使用https://github.com/patrickbussmann/oauth2-apple允许在我的一个应用程序中使用Apple ID登录。授权部分由Ionic应用程序处理,并通过rest api发送Apple授权提供的数据。

根据图书馆,我提供了以下内容:

$provider = new League\OAuth2\Client\Provider\Apple([
    'clientId'          => '{apple-client-id}',
    'teamId'            => '{apple-team-id}', // 1A234BFK46 https://developer.apple.com/account/#/membership/ (Team ID)
    'keyFileId'         => '{apple-key-file-id}', // 1ABC6523AA https://developer.apple.com/account/resources/authkeys/list (Key ID)
    'keyFilePath'       => '{apple-key-file-path}', // __DIR__ . '/AuthKey_1ABC6523AA.p8' -> Download key above 
    'redirectUri'       => 'https://example.com/callback-url',
]);

而且,我将getAccessToken称为:

 $token = $provider->getAccessToken('authorization_code', [
        'code' => $_POST['code']
    ]);

执行该操作时,出现以下错误:

{
  "message": "invalid_grant"
}

有人可以帮我解决这个问题吗?

谢谢。

0 个答案:

没有答案