Closed
Description
I am using the V2 SDK to do admin initiated auth and refresh token.
I am using ADMIN_NO_SRP_AUTH flow type to authenticate a user using username, password and it works fine.
I then try to use the returned refresh token to make another call to cognito with auth flow type REFRESH_TOKEN_AUTH and I get back a response saying "Invalid Refresh Token. (Service: CognitoIdentityProvider, Status Code: 400, Request ID: 9d635f71-b8fa-49ef-8237-14d5ba9fbc3c)".
Please note the app client id I am using doesn't have an app client secret configured. "Remember user's device" config is set to "User Opt In". MFA is turned off.
Expected Behavior
Refresh token should succeed
Current Behavior
AWS returns a http status 400 for refresh token.
Possible Solution
Steps to Reproduce (for bugs)
Authenticate code:
Map<String, String> authParams = Map.of("USERNAME", authenticationRequest.getUserName(),
"PASSWORD", authenticationRequest.getPassword());
var req = AdminInitiateAuthRequest
.builder()
.authFlow(AuthFlowType.ADMIN_NO_SRP_AUTH)
.userPoolId(userPoolId)
.clientId(clientId)
.authParameters(authParams)
.build();
var client = CognitoIdentityProviderClient.builder().build();
var res = client.adminInitiateAuth(req);
var authRes = res.authenticationResult();
Code for refresh token:
Map<String, String> authParams = Map.of("REFRESH_TOKEN", refreshTokenReq.getRefreshToken());
var req = AdminInitiateAuthRequest
.builder()
.authFlow(AuthFlowType.REFRESH_TOKEN_AUTH)
.userPoolId(userPoolId)
.clientId(clientId)
.authParameters(authParams)
.build();
var client = CognitoIdentityProviderClient.builder().build();
var res = client.adminInitiateAuth(req);
var authRes = res.authenticationResult();
Context
Your Environment
- AWS Java SDK version used: software.amazon.awssdk@2.7.26
- JDK version used: 11
- Operating System and version:
Metadata
Metadata
Assignees
Labels
No labels