Closed yohaiaz closed 1 year ago
I'm also interested in this, because I was hoping to get the "username" (which in my case, is an email address), but instead the "username" looks like some type of anonymized hash.
Hello, currently auth_required()
method returns CognitoToken model. I will update lib and add support for custom models. Thank you for feedback!
Hello, I just published new release with support for custom token models, check example in README.md .
hi, is there a way to get the custom attributes that belongs to the user of the cognito user pool ?
I mean:
@app.get("/") def hello_world(auth: CognitoToken = Depends(cognito_us.auth_required)): return auth
this is what i'm getting { "origin_jti": "XXXXX", "sub": "XXXXX", "event_id": "XXXXX", "token_use": "access", "scope": "aws.cognito.signin.user.admin", "auth_time": 1669899648, "iss": "https://cognito-idp.us-east-1.amazonaws.com/us-east-1XXXXX", "exp": 1669903248, "iat": 1669899648, "jti": "XXXXX", "client_id": "XXXXX", "username": "XXXXX" }
but each user in the cognito user pool have also custom attributes that i can declare, or group... for instance i declared 2 custom attributes "custom:first_name" and "custom:last_name".... is there a way to get them so it will be more simple to have this information ready