Setting the address attribute in an AWS Cognito user pool using an object

Viewed 603

According to the docs the Cognito 'address' attibute should follow the OpenID spec, which allows for an object with fields:

formatted
    Full mailing address, formatted for display or use on a mailing label. This field MAY contain multiple lines, separated by newlines. Newlines can be represented either as a carriage return/line feed pair ("\r\n") or as a single line feed character ("\n"). 
street_address
    Full street address component, which MAY include house number, street name, Post Office Box, and multi-line extended street address information. This field MAY contain multiple lines, separated by newlines. Newlines can be represented either as a carriage return/line feed pair ("\r\n") or as a single line feed character ("\n"). 
locality
    City or locality component. 
region
    State, province, prefecture, or region component. 
postal_code
    Zip code or postal code component. 
country
    Country name component. 

Is it possible in Cognito to set these fields? I tried setting the address with a stringified object, i.e., JSON.stringify({"locality": "Auckland", "country": "New Zealand"}). But when I returned the claims object from authorization at the AWS API gateway, I got the address: { formatted: '{"locality":"Auckland","country":"New Zealand"}' }. So it seems it is just taking whatever string I send it and setting that as the 'formatted' address.

I'm using the Amplify Auth api to interact with cognito.

0 Answers
Related