cognito-local icon indicating copy to clipboard operation
cognito-local copied to clipboard

Attempting to getUser for a migrated user results in UserNotFound exception

Open stocks29 opened this issue 2 years ago • 0 comments

This is because the sub attribute is not populated in the access token for migrated users, so this lookup fails:

  const user = await userPool.getUserByUsername(ctx, decodedToken.sub);
  if (!user) {
    throw new import_errors.UserNotFoundError();
  }

stocks29 avatar Aug 29 '22 23:08 stocks29