title: AWS Cognito PHP SDK - Unable to verify secret hash for client
body: <p>So far I created user pool, app client and marked Generate client secret box.
  I am able to register, login, logout.
  But I'm unable to refresh token using REFRESH_TOKEN_AUTH flow.</p>
  <pre><code>private function refreshConf($refreshToken, $hash)
  {
      return [
          'AuthFlow' =&gt; 'REFRESH_TOKEN_AUTH',
          'ClientId' =&gt; $this-&gt;client_id,
          'UserPoolId' =&gt; $this-&gt;userpool_id,
          'AuthParameters' =&gt; [
              'REFRESH_TOKEN' =&gt; $refreshToken,
              'SECRET_HASH' =&gt; $hash
          ]
      ];
  }
  
  public function refreshToken(string $refreshToken, string $hash)
  {
      try {
          $conf = $this-&gt;refreshConf($refreshToken, $hash);
          $result = $this-&gt;client-&gt;InitiateAuth($conf);
          $result = $result-&gt;toArray();
          logger($result);
          if (isset($result['AuthenticationResult'])) {
              return [
                  'error' =&gt; false,
                  'message' =&gt; 'SUCCESS',
                  'data' =&gt; $result
              ];
          }
      } catch (\Exception $e) {
          logger(get_class($e));
          return [
              'error' =&gt; true,
              'message' =&gt; $e-&gt;getAwsErrorMessage()
          ];
      }
  }
  </code></pre>
  <p>And my function to generate secret hash:</p>
  <pre><code>public function cognitoSecretHash($username)
  {
      $hash = hash_hmac('sha256', $username . $this-&gt;client_id, $this-&gt;client_secret, true);
      return base64_encode($hash);
  }
  </code></pre>
  <p>Secret hash is stored in User model during registration so I can send it when I want to refresh the token. But every time <code>Aws\CognitoIdentityProvider\Exception\CognitoIdentityProviderException</code>
  is thrown. And I get the response <code>Unable to verify secret hash for client d***************9</code>.
  So far I've spent hours trying too google the solution. There seems to be a problem with javascript SDK, but no mentions of PHP. I've gone through AWS documentation and can't find what am I doing wrong. I would appreciate any help. Thanks.</p>