Legal Consent
Legal Consent plugin for Better Auth Kit
Require your users to accept the required compliances before they can sign up.
Supported compliances include:
- Terms of Service
- Privacy Policy
- Age Verification
- Marketing Consent
- Cookie Consent
This plugin does not come with UI, this is purely functionality. We recommend checking out our UI components registry to implement shadcn styled components.
2. Initialize
What does it do?
By utilizing the legalConsent
plugin, you can require the following legal consents on your sign-up routes:
- Terms of Service
- Privacy Policy
- Age Verification
- Marketing Consent
- Cookie Consent
Whenever a user signs up, the plugin requires you to pass additional data to the signup
method.
The data can vary depending on the legal consent requirements you have set.
For example, if you require the user to accept the terms of service, you must pass tosAccepted: true
to the signup
method.
After the plugin has verified the given data is all valid, it will pass those legal consent values to the user data that will be created.
Options
Legal Compliance Configuration
You can enable the following legal compliance options:
Configuring the schema
You can configure the name of these fields by passing the schema
option to the plugin.
Schema
Table: user
Note: Not all keys will be in the table as it depends on if you enabled each compliance, as well as if you changed the name of a given schema field.
Field Name | Type | Key | Description |
---|---|---|---|
tosAccepted | boolean | - | Wether the user accepted the TOS. |
requirePrivacyPolicy | boolean | - | Wether the user accepted the privacy policy. |
requireAgeVerification | boolean | - | Wether the user accepted the age verification. |
requireMarketingConsent | boolean | - | Wether the user accepted the marketing consent. |
requireCookieConsent | boolean | - | Wether the user accepted the cookie consent. |