tokusumi / fastapi-cloudauth

Simple integration between FastAPI and cloud authentication services (AWS Cognito, Auth0, Firebase Authentication).
MIT License
323 stars 35 forks source link

cognito: "Validation Error for Claims" - when using custom attributes in cognito #72

Open JustinGuese opened 2 years ago

JustinGuese commented 2 years ago

Hey, I just can't get cognito to work with this library... I am using the second example

def secure_access(current_user: AccessUser = Depends(auth.claim(AccessUser))):
    # access token is valid and getting user info from access token
    return f"Hello", {current_user.sub}

with the example

class AccessUser(BaseModel):
    sub: str

But as soon as I add custom attributes that are set in my cognito pool, like "email" or "family_name", it throws the error "Validation Error for Claims"

How can I add custom attributes to grab them like current_user.family_name ?

onejgordon commented 8 months ago

Also interested in whether additional custom Cognito attributes are supported.