Skip to content

Commit

Permalink
Use guzzle http client instead of file_get_contents
Browse files Browse the repository at this point in the history
Many servers have allow_fopen_url disabled so they cant use file_get_contents to load apple keys.
  • Loading branch information
williamxsp committed Jul 31, 2020
1 parent 754769b commit 81164c4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Token/AppleAccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@ public function __construct(array $options = [])
*/
protected function getAppleKey()
{
return JWK::parseKeySet(json_decode(file_get_contents('https://appleid.apple.com/auth/keys'), true));
$client = new \GuzzleHttp\Client();
$request = $client->get('https://appleid.apple.com/auth/keys');
$response = $request->getBody();

if($response){
return JWK::parseKeySet(json_decode($response, true));
}
return false;
}

/**
Expand Down

0 comments on commit 81164c4

Please sign in to comment.