We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b91d1a4 commit da48774Copy full SHA for da48774
fproject/authclient/OAuth2.php
@@ -154,11 +154,18 @@ public function getPublicKey()
154
155
if(empty($jwk))
156
{
157
- $jwk = $this->api($this->jwkUrl, 'GET');
158
- if(!empty($jwk) && Yii::$app->cache)
159
- Yii::$app->cache->set($cacheKey, $jwk, self::PUBLIC_KEY_EXPIRE_DURATION);
+ $res = $this->createRequest()
+ ->setMethod('GET')
+ ->setUrl($this->jwkUrl)
160
+ ->send();
161
+ if(!empty($res)) {
162
+ $jwk = $res->getContent();
163
+ if(!empty($jwk) && Yii::$app->cache)
164
+ Yii::$app->cache->set($cacheKey, $jwk, self::PUBLIC_KEY_EXPIRE_DURATION);
165
+ } else {
166
+ throw new UnauthorizedHttpException("Can\'t get public key");
167
+ }
168
}
-
169
if(!empty($jwk))
170
$this->_publicKey = JWK::parseKeySet($jwk);
171
0 commit comments