Skip to content

ADMIN_NO_SRP_AUTH + Rotating Refresh Tokens --> Invalid Refresh Token #7162

@enchorb

Description

@enchorb

Checkboxes for prior research

Describe the bug

Refresh token from ADMIN_NO_SRP_AUTH does not work with rotating refresh tokens getTokensFromRefreshToken . Get the error NotAuthorizedException - Invalid Refresh Token.

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v22.16.0

Reproduction Steps

Pass refresh token from cognitoIdentityProvider.adminInitiateAuth({ AuthFlow: 'ADMIN_NO_SRP_AUTH', ... }) to cognitoIdentityProvider.getTokensFromRefreshToken

Observed Behavior

 err: {
      "type": "NotAuthorizedException",
      "message": "Invalid Refresh Token.",
      "stack":
          NotAuthorizedException: Invalid Refresh Token.
              at de_NotAuthorizedExceptionRes (D:\Code\node_modules\@aws-sdk\client-cognito-identity-provider\dist-cjs\index.js:4792:21)
              at de_CommandError (D:\Code\node_modules\@aws-sdk\client-cognito-identity-provider\dist-cjs\index.js:4419:19)
              at processTicksAndRejections (node:internal/process/task_queues:105:5)
              at D:\Code\node_modules\@smithy\middleware-serde\dist-cjs\index.js:36:20
              at D:\Code\node_modules\@smithy\core\dist-cjs\index.js:193:18
              at D:\Code\node_modules\@smithy\middleware-retry\dist-cjs\index.js:320:38
              at data (D:\Code\node_modules\@aws-sdk\middleware-logger\dist-cjs\index.js:33:22)
              at data (D:\\Code\\dist\apps\backend\flow\webpack:\libs\core\src\functions\utils.ts:40:9)
              at t.tokenHandler (D:\\Code\\dist\apps\backend\flow\webpack:\libs\backend\auth\src\handlers\oauth.ts:319:11)
      "name": "NotAuthorizedException",
      "$fault": "client",
      "$metadata": {
        "httpStatusCode": 400,
        "requestId": "2c81fed1-47e1-49b3-9a34-29a5840bc256",
        "attempts": 1,
        "totalRetryDelay": 0
      },
      "__type": "NotAuthorizedException"
    }

Expected Behavior

Refresh token works

Possible Solution

No response

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p2This is a standard priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions