使用对象在AWS Cognito用户池中设置地址属性

问题描述

根据docs,Cognito的“地址”外观应遵循OpenID spec,这允许带有字段的对象:

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 @R_788_4045@ion. 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. 

在Cognito中可以设置这些字段吗?我尝试使用字符串对象JSON.stringify({"locality": "Auckland","country": "New Zealand"})设置地址。但是,当我从AWS API网关的授权返回索赔对象时,得到了address: { formatted: '{"locality":"Auckland","country":"New Zealand"}' }。因此看来,它只是采用我发送的任何字符串并将其设置为“格式化”地址。

我正在使用Amplify Auth api与cognito进行交互。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)