AWS Cognito - I am refreshing token using adminInitiateAuth() method, but its giving error "unable to verify secret hash".
I am using PHP SDK
The same secret hash is working on signing user. Below is the return response AWS Cognito -
```"message": "Error executing \"AdminInitiateAuth\" on AWS HTTP error: Client error: `POST`
Unable to verify secret hash for client```
HASH GENERATION
public function cognitoSecretHash($username){
$hash = hash_hmac(
'sha256',
$username. $this->client_id,
$this->client_secret,
true
);
return base64_encode($hash);
}
$response = $this->client->adminInitiateAuth([
'AuthFlow' => 'REFRESH_TOKEN_AUTH',
'AuthParameters' => [
'USERNAME' => $username,
'REFRESH_TOKEN' => $refreshToken,
'SECRET_HASH' => $this->cognitoSecretHash($username)
],
'ClientId' => $this->client_id,
'UserPoolId' => $this->userpool_id
])->toArray();