Skip to main content
ConsentMembers
Example
export interface ConsentMembers extends BaseMembers {
  /**
   * Provides access to the specific properties and data of the Consent screen,
   * including the list of `scopes` being requested and the `hideScopes` flag.
   * @type {ScreenMembersOnConsent}
   */
  screen: ScreenMembersOnConsent;

  /**
   * Submits the user's decision to accept (grant) the requested permissions.
   * This action posts to the `/u/consent` endpoint with `action: "accept"`.
   *
   * @param {CustomOptions} [payload] - Optional. An object for any custom key-value pairs
   *                                    to be sent with the request. These parameters will be
   *                                    included in the form data submitted to the server.
   * @returns {Promise<void>} A promise that resolves when the accept action is successfully submitted.
   *                          On success, Auth0 typically redirects the user back to the application
   *                          or to the next step in the authentication flow.
   * @throws {Error} Throws an error if the form submission fails (e.g., network issue, invalid state).
   *                 Server-side errors (like "invalid_request") will be reflected in `this.transaction.errors`
   *                 after the operation, rather than being thrown as JavaScript errors.
   *
   * @example
   * ```typescript
   * // Assuming 'consentManager' is an instance of the Consent screen SDK class
   * try {
   *   await consentManager.accept();
   *   // If successful, the page will typically redirect.
   * } catch (error) {
   *   // Handle unexpected errors during the submission itself.
   *   console.error("Failed to submit consent acceptance:", error);
   * }
   * // After the await, check consentManager.transaction.errors for server-side validation issues.
   * ```
   */
  accept(payload?: CustomOptions): Promise<void>;

  /**
   * Submits the user's decision to deny (reject) the requested permissions.
   * This action posts to the `/u/consent` endpoint with `action: "deny"`.
   *
   * @param {CustomOptions} [payload] - Optional. An object for any custom key-value pairs
   *                                    to be sent with the request. These parameters will be
   *                                    included in the form data submitted to the server.
   * @returns {Promise<void>} A promise that resolves when the deny action is successfully submitted.
   *                          On success, Auth0 typically redirects the user, potentially showing an
   *                          access denied message or returning an error to the application.
   * @throws {Error} Throws an error if the form submission fails (e.g., network issue, invalid state).
   *                 Server-side errors are reflected in `this.transaction.errors`.
   *
   * @example
   * ```typescript
   * // Assuming 'consentManager' is an instance of the Consent screen SDK class
   * try {
   *   await consentManager.deny({ reason: "user_declined" }); // Example custom option
   *   // If successful, the page will typically redirect.
   * } catch (error) {
   *   console.error("Failed to submit consent denial:", error);
   * }
   * // After the await, check consentManager.transaction.errors for server-side validation issues.
   * ```
   */
  deny(payload?: CustomOptions): Promise<void>;
}

Properties

branding
client
organization
prompt
screen
Provides access to the specific properties and data of the Consent screen, including the list of scopes being requested and the hideScopes flag.
tenant
transaction
untrustedData
user

Methods

accept
Promise<void>
Submits the user’s decision to accept (grant) the requested permissions. This action posts to the /u/consent endpoint with action: "accept".A promise that resolves when the accept action is successfully submitted. On success, Auth0 typically redirects the user back to the application or to the next step in the authentication flow.

Throws

Throws an error if the form submission fails (e.g., network issue, invalid state). Server-side errors (like “invalid_request”) will be reflected in this.transaction.errors after the operation, rather than being thrown as JavaScript errors.
Example
// Assuming 'consentManager' is an instance of the Consent screen SDK class
try {
  await consentManager.accept();
  // If successful, the page will typically redirect.
} catch (error) {
  // Handle unexpected errors during the submission itself.
  console.error("Failed to submit consent acceptance:", error);
}
// After the await, check consentManager.transaction.errors for server-side validation issues.
deny
Promise<void>
Submits the user’s decision to deny (reject) the requested permissions. This action posts to the /u/consent endpoint with action: "deny".A promise that resolves when the deny action is successfully submitted. On success, Auth0 typically redirects the user, potentially showing an access denied message or returning an error to the application.

Throws

Throws an error if the form submission fails (e.g., network issue, invalid state). Server-side errors are reflected in this.transaction.errors.
Example
// Assuming 'consentManager' is an instance of the Consent screen SDK class
try {
  await consentManager.deny({ reason: "user_declined" }); // Example custom option
  // If successful, the page will typically redirect.
} catch (error) {
  console.error("Failed to submit consent denial:", error);
}
// After the await, check consentManager.transaction.errors for server-side validation issues.