How do I access address or date of birth?

Hey

I am getting my users to log in with BankID, and a lot of information is sent to Auth0. I am using actions create custom accounts in stripe when the users are logging into my application. Stripe is requesting address and date of birth, which I see that I have under "user management > user > userdata. However when I use event.user.address or event.user.street_address, or event.user.dateofbirth, it doesnt appear. No other suggested alternative appears either. I have found out that it should be accessed in users_metadata, but under “user management > user > userdata”, there is nothing there. I have made sure I am syncing the user on each log in. Is there another way other than user_metadata where I can access streetaddress and date of birth/birthdate? If no, how can I make sure the user_metadata is populated. I am using Flutter as frontend.

Hi @monhelle ,

Thank you for posting this topic on the Auth0 Community!

Stripe is requesting address and date of birth, which I see that I have under "user management > user > userdata

Usually, the user’s PII data or address data are stored in the user-metadata field. This article explains how to manage user-metadata with the Management API.

To access details under user_metadata in Action, we can use the event.user.user_metadata.street_address and event.user.user_metadata.dataofbirth parameters.

Stripe is requesting address and date of birth, which I see that I have under "user management > user > userdata

Could you provide additional contexts, such as a screenshot of where we can see the userdata field, address, and date of birth?

Thanks!


It was under “Identity Provider Attributes” @lihua.zhang

Hi @monhelle ,

Thank you for providing additional context.

I understand that you want to update the custom identity provider attributes in Action. Actually, such attributes can not be accessed in Action as per the current design but should be accessible in Rules.

The caveat is that rule will be deprecated at some point and our product team has not released the ETA regarding when this feature will be supported in Action yet. Therefore, I suggest you save the dateofbirth and address info in the user_metadata as an alternative.

Hope this helps!

@lihua.zhang Thanks for your reply, it did. However, when I try to save it in the user_metadata, then
I get a 404 not found for the body, i.e the meta_data

sendMetaData(String criiptoId, String accessToken, String birthDate) async {
    final url = Uri.https(
      AUTH0_DOMAIN,
      '/api/v2/users/' + criiptoId + '/',
    );
var body = jsonEncode({
  'user_metadata': {'birthdate': birthDate}
});

  final response = await http.patch(
    url,
    headers: {
      'Authorization': 'Bearer $accessToken',
      'content-type': "application/json"
    },
    body: body,
  );

}

Metadata output:
{“user_metadata”:{“birthdate”:“1990-06-25”}}

Response.body output:
flutter: sendMetaData body {“statusCode”:404,“error”:“Not Found”,“message”:“Not Found”}

Do you know why it says “not found” for the body?

Hi @monhelle,

Thank you for the updates.

In your scripts, The accessToken and birthDate are passed to the function as a String type of parameters. When calling them, you used $accessToken and birthDate.

Could you please replace
'Authorization': 'Bearer $accessToken'
with
'Authorization': 'Bearer' + accessToken

Please keep me updated on how it goes. Thanks!

Hello! Thanks for your reply @lihua.zhang . I did what you asked but it didnt do anything to solve the problem unfortunately. Any other ideas?


flutter: metadata {"user_metadata":{"birthdate":"1990-06-25"}}**

flutter: sendMetaData 404**

flutter: sendMetaData body {"statusCode":404,"error":"Not Found","message":"Not Found"}**

This topic was automatically closed after 11 days. New replies are no longer allowed.