Closed huthief closed 2 years ago
I got the answer XD
$options = [ 'state' => 'OPTIONAL_CUSTOM_CONFIGURED_STATE', // Scopes: https://developer.apple.com/documentation/authenticationservices/asauthorizationscope 'scope' => ['name', 'email'] // array or string ];
$authorizationUrl = $provider->getAuthorizationUrl($options);
At League/oauth2-client, we can add state option at provider's option array. But it's not work at oauth2-apple. Is possible add state option for provider like this?
$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', 'state' => 'customize state string', 'scope' => ['name', 'email'], ]);