Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for signup with root level attributes #1656

Merged
merged 6 commits into from
Jun 25, 2019

Conversation

luisrudge
Copy link
Contributor

@luisrudge luisrudge commented May 24, 2019

Changes

When using additionalSignUpFields, you can now use a new property called storage to determine where the field will be stored. root will save it in the root profile. anything else will save it under user_metadata. There is no default (which means it will save to user_metadata).

References

https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id

Testing

  • This change adds unit test coverage

@luisrudge luisrudge requested a review from a team May 24, 2019 21:25
Copy link
Contributor

@joshcanhelp joshcanhelp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luisrudge - At first glance, this looks fine but does this just automatically start saving custom signup fields to a different place? What if someone is already using the current implementation and expects that data to continue to be saved to usermeta? Isn't that breaking?

When we first started talking about this, my idea was to add a property to the signup fields JS to indicate that you want to save this to the root profile. Like so:

var options = {
  additionalSignUpFields: [{
    name: "full_name",
    root_profile_field: "full_name"
    placeholder: "Enter your full name"
  }]
}

@luisrudge
Copy link
Contributor Author

@joshcanhelp made it opt-in per field

@damieng
Copy link
Contributor

damieng commented Jun 5, 2019

@joshcanhelp it doesn't change behavior for existing fields - right now they go to user metadata. The default for 'storage' is user metadata.

The rationale for this design was to:

  1. Keep backwards compatible
  2. Allow for future expansion if other alternatives to user metadata and root profile attributes are added
  3. Make it clear where data is stored

(A flag or opt-in to root profile attributes tied to that name, e.g. useRootProfileAttributes - fails objective 2 and 3)

@luisrudge luisrudge added this to the v11.17.0 milestone Jun 13, 2019
@luisrudge
Copy link
Contributor Author

@joshcanhelp updated PR and description

@luisrudge luisrudge merged commit fb4948c into master Jun 25, 2019
@luisrudge luisrudge deleted the feature/root-level-attributes branch June 25, 2019 17:37
@luisrudge luisrudge changed the title Add support for root level attributes Add support for signup with root level attributes Jul 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants