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

Synchronise user details from Auth0 to the database #78

Closed
AlexGilleran opened this issue Nov 7, 2020 · 0 comments
Closed

Synchronise user details from Auth0 to the database #78

AlexGilleran opened this issue Nov 7, 2020 · 0 comments

Comments

@AlexGilleran
Copy link
Member

In order to do notifications we need a way of getting user details. E.g. when a ride gets cancelled we need to get the user's email address and name, when a driver withdraws we need to be able to email the facilitator, sometimes we need to be able to email all the drivers etc.

It's probably possible to do this by querying auth0 directly, but I think it'll be simpler if we just keep that data in our database and have Auth0 sync it.

There's a few ways to achieve this, but I think the best way is probably to sync users from Auth0 to our database, then we can use our database from then on. In order to do this we'll need to figure out how to make it so that changes (new users, changes to user details like email address changes) end up getting synced to our database. There are hooks in Auth0 that can probably be set up to do this, and that seems like the best bet. If that fails, there's also:

  • Auth0 webhooks, which look a bit complicated
  • Grabbing things on a recurring basis (which means they might get out of date)
  • Copying user data across on login (also means they might get out of date)

In order to make the Auth0 hook idea work, we'll need to both create a hook in Auth0 that sends data to our app when user information is created or changes, and also create an API in our app that receives the data in a secure way. This will probably involve having some kind of shared secret.

Criteria

  • When a new user is created (by logging in for the first time), our database receives that user's details
  • When a user's details change in Auth0 (e.g. name, roles etc), our database receives the new details. Hopefully this caters for changes that flow through from Facebook etc.
  • Our database keeps track of users':
    • Name
    • Email address
    • Roles
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

No branches or pull requests

1 participant