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的结果,我无法再次刷新令牌吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)