php - aws php刷新令牌,没有返回刷新令牌
问题描述
我有 aws sdk php cognito 来刷新令牌,
public function refreshToken($username, $refreshToken)
{
try {
$response = $this->client->initiateAuth([
'AuthFlow' => 'REFRESH_TOKEN_AUTH',
'AuthParameters' => [
'SECRET_HASH' => $this->cognitoSecretHash($username),
'REFRESH_TOKEN' => $refreshToken
],
'ClientId' => $this->client_id,
]);
} catch (CognitoIdentityProviderException $exception) {
if ($exception->getAwsErrorCode() === self::NOT_AUTHORIZED) {
$this->add_error('You are unauthorized to access this resource');
return false;
}
throw $exception;
}
return $response;
}
刷新令牌返回成功 200,但在 AuthenticationResult 中返回 RefreshToken 丢失:
[
'AuthenticationResult' => [
'AccessToken' => '<string>',
'ExpiresIn' => <integer>,
'IdToken' => '<string>',
'RefreshToken' => '<string>', // return missing RefreshToken
'TokenType' => '<string>',
],
...
]
为什么缺少 AuthenticationResult 中的 RefreshToken?如果无法提供来自initialAuth REFRESH_TOKEN_AUTH 的结果,我无法再次刷新令牌?
解决方案
推荐阅读
- firefox - 赛普拉斯 Firefox
- spring-boot - 使用投影/视图作为@RequestBody
- c++ - SIGABRT 在 C++ 中使用 std::thread 和 std::condition_variable 进行自定义后台任务
- reactjs - 我如何访问组件字段 - React JS
- android - Kotlin 未实例化类列表
- python - 在 Python 中统一从分区中采样
- java - Netbeans compileRetrolambdaMain:失败
- android - 测试片段:我不断收到 java.lang.RuntimeException: android.view.InflateException
- css - 车把表达 css 文件未加载
- python - 如何以编程方式从 Python 中的融合模式注册表中获取模式