consentGiven
(true/false) shows if the user has provided consent (true) or not (false)consentTimestamp
(Unix timestamp) indicates when the user-provided consentSingle Web Page Applications
as type. Go to Settings and set the Allowed Callback URLs to http://localhost:3000
.
This field holds the set of URLs to which Auth0 is allowed to redirect the users after they authenticate. Our sample app will run at http://localhost:3000
hence we set this value.
Custom Login Form
is picked. The code is pre-populated for you.
databaseConnection
variable to the name of the database connection your app is using.
consentGiven
metadata, add a checkbox at the form. For our example, we will configure the checkbox as checked by default and disabled so the user cannot uncheck it. You can adjust this according to your business needs.
true
and not to a boolean value, and we are using toString
to convert the number to a string. This is due to a restriction of the Authentication API Signup endpoint which only accepts strings as values.
http://localhost:3000
. Sign up with a new user. Then go to Auth0 Dashboard > User Management > Users and search for your new user. Go to User Details and scroll down to the Metadata section. At the user_metadata text area, you should see the consentGiven
metadata set to true
.consentTimestamp
request parameter with the timestamp of when the user provided consent.
true
and not to a boolean value due to the API restriction that accepts strings as values, not booleans.
If setting boolean values is a requirement for you, you can use the instead. In this scenario you sign up your user as usual, and then you call the Management API Update User endpoint to set the required metadata after the user has been created. For details on how to do that keep reading, the next paragraph uses that endpoint.
https://YOUR_DOMAIN/api/v2/
and the scope parameter to the scope create:current_user_metadata
. You can use the you will get at the response to call the Management API Update User endpoint.
Once you have a valid token, use the following snippet to update the user’s metadata.
user_id
. You can retrieve this from the sub
claim of the , if you got one from the response. To learn more, read ID Tokens. Alternatively, if all you have is the email, you can retrieve the Id by calling another endpoint of the Management API. To learn more, read User Search Best Practices.
empty rule
to something descriptive (e.g., Redirect to consent form
).
CONSENT_FORM_URL
your-consent-form-url.com
https://localhost:3000
.consentGiven
metadata set to true
and the consentTimestamp
set to the Unix timestamp of the moment the user consented.