Unable to read `email_verified` from the Cognito adminGetUser API

0

I have a Cognito user whose email is “Not verified”:

Example from Cognito dashboard

When I query them, I see nothing about email_verified in the API response:

const AWS = require('aws-sdk');
const cognitoIsp = new AWS.CognitoIdentityServiceProvider();
await cognitoIsp.adminGetUser({ UserPoolId: userPoolId, Username: username }).promise();

{
  Username: '9dXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX86',
  UserAttributes: [
    { Name: 'sub', Value: '9dXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX86' },
    { Name: 'email', Value: 'syXXX@XXXXXXXX.com' },
    {
      Name: 'custom:identity_id',
      Value: 'us-east-1:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
    }
  ],
  UserCreateDate: 2023-12-08T15:41:25.328Z,
  UserLastModifiedDate: 2023-12-08T15:46:47.209Z,
  Enabled: true,
  UserStatus: 'CONFIRMED'
}

I understand that I can set email_verified using the API (e.g., this docs page). But how can I read that state of email_verified from the API??

PeterFP
feita há 5 meses128 visualizações
1 Resposta
0
Resposta aceita

It looks like the issue was that my perms for Cognito needed to add “email_verified” as a readable attribute. From this SO post:

Go to: General settings -> App clients -> Show details -> Set attribute read and write permissions link and check off Readable Attributes: Email Verified

Since I’m using Cognito with AWS Amplify, I was able to run amplify update auth and eventually find my way to that setting. FWIW, that triggered an issue with Amplify where it wiped all my App Client information because I have different settings for different environments as documented in this github issue.

PeterFP
respondido há 4 meses
profile picture
ESPECIALISTA
avaliado há um mês

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas