auth0 / auth0-flutter

Auth0 SDK for Flutter
https://pub.dev/documentation/auth0_flutter/latest/
Apache License 2.0
59 stars 39 forks source link

Is it possible to add column created_at in Auth0.webAuthentication().login() method return (Credentials) in iOS? #275

Closed geniallink closed 1 year ago

geniallink commented 1 year ago

Checklist

Describe the problem you'd like to have solved

I'd like to have the created_at column to check if the user loggin in is a newly created user or not (I don't want control that in app side, because user can access app across other platforms).

I tried using custom claims but returns a sid in Credentials.user.customClaims, how can I use this sid to get the custom claims?

Describe the ideal solution

Return the created_at field in class Credentials.user

Alternatives and current workarounds

As a workaround I am doing a get request in the URL https://my-app.us.auth0.com/api/v2/users/[userId] using a management api key making, which is far from ideal to keep this key in the app (in my case, a mobile app).

Additional context

No response

Widcket commented 1 year ago

Hi @geniallink, thanks for raising this.

A custom claim is indeed the way to go for this. Credentials.user.customClaims is a map, so it should contain the custom claim, provided it was set using an Action/Rule.

Please check https://auth0.com/blog/adding-custom-claims-to-id-token-with-auth0-actions/ to learn more about adding custom claims to the ID token.

Widcket commented 1 year ago

Closing, as I believe the above answers your question. Please feel free to ping if you'd prefer to reopen.