NabuCasa / pycognito

Python library for using AWS Cognito. With support for SRP.
Apache License 2.0
126 stars 38 forks source link

Unable to get user data #232

Open CGarces-Apser opened 3 months ago

CGarces-Apser commented 3 months ago

I'm trying to fetch data from a user using pycognito.

This code give all de users in the pool, so the connection to AWS is working fine

    c = Cognito(
        cognito_service.COGNITO_USER_POOL_ID, cognito_service.COGNITO_APP_CLIENT_ID
    )
    response = c.get_users(attr_map={})

But the same code using get_user_obj

    c = Cognito(
        cognito_service.COGNITO_USER_POOL_ID, cognito_service.COGNITO_APP_CLIENT_ID
    )
    response = c.get_user_obj(username=username, attribute_list=[{}])

Always return a dummy object with all values set to None except for the username that is populated allways, also with not existing users.

I have tested also get_user

    c = Cognito(
        cognito_service.COGNITO_USER_POOL_ID,
        cognito_service.COGNITO_APP_CLIENT_ID,
        username=username,
    )
    response = c.get_user(attr_map={})

That raise a boto3 exception

botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter AccessToken, value: None, type: <class 'NoneType'>, valid types: <class 'str'>

My cognito pool use only "email", not "username" for login, I'm not sure if is de reason for the error.

Any hint to solve my issues fetching the user data?