Amplify-JS: how to change refresh token endpoint?

52 views Asked by At

I'm using amplify-js for Cognito Auth. After amplify has authorized the user it stores all access, id, and refresh tokens locally. At some point these tokens will expire and then Amplify will make a request to Cognito to ask for new tokens using the local refresh token. The request will look something like this:

curl 'https://cognito-idp.<region>.amazonaws.com/' \
  -H 'content-type: application/x-amz-json-1.1' \
  -H 'x-amz-target: AWSCognitoIdentityProviderService.InitiateAuth' \
  -H 'x-amz-user-agent: aws-amplify/5.0.4 js' \
  --data-raw '{"ClientId":"xxxxx","AuthFlow":"REFRESH_TOKEN_AUTH","AuthParameters":{"REFRESH_TOKEN":"xxxxxx","DEVICE_KEY":null}}' \
  --compressed

For whatever reason, I don't want Amplify to call Cognito's InitiateAuth endpoint. Instead, I want to change it to call Cognito Token endpoint (/oauth2/token docs). Does anybody know how I can achieve that?

0

There are 0 answers