Consent screen class

The Consent screen class provides methods associated with the consent screen.

Import and instantiate the Consent screen class:

import Consent from '@auth0/auth0-acul-js/consent';
    const consentManager = new Consent();

Was this helpful?

/

Properties

The Consent screen class properties are:

interface branding {
  settings: null | BrandingSettings;
  themes: null | BrandingThemes;
}

interface BrandingSettings {
  colors?: {
    pageBackground?: string | {
      angleDeg: number;
      end: string;
      start: string;
      type: string;
    };
    primary?: string;
  };
  faviconUrl?: string;
  font?: {url: string;};
  logoUrl?: string;
}

interface BrandingThemes {
  default: {
    borders: Record<string, string | number | boolean>;
    colors: Record<string, string>;
    displayName: string;
    fonts: Record<string, string | boolean | object>;
    pageBackground: Record<string, string>;
    widget: Record<string, string | number>;
  };
}

Was this helpful?

/

Methods

The Consent screen class methods are:

accept( options? )

This method submits the user's decision to accept the requested permissions.

import Consent from '@auth0/auth0-acul-js/consent';
const consentManager = new Consent();
const handleAccept = async () => {
 try {
   await consentManager.accept();
   console.log('Consent accepted successfully.');
 } catch (err) {
   console.error('Error accepting consent:', err);
 }
};

Was this helpful?

/

Parameter                  Type Required Description
[key: string] string | number | boolean | undefined No Optional data collected from user.

deny( options? )

This method submits the user's decision to deny the requested permissions.

import Consent from '@auth0/auth0-acul-js/consent';
const consentManager = new Consent();
const handleDeny = async () => {
 try {
   await consentManager.deny();
   console.log('Form denied successfully.');
 } catch (err) {
   console.error('Failed to deny form:', error);
 }

Was this helpful?

/

Parameter                  Type Required Description
[key: string] string | number | boolean | undefined No Optional data collected from user.

getError( options? )

This method retrieves the array of transaction errors from context or an empty array if none exist.

import Consent from '@auth0/auth0-acul-js/consent';
    const consentManager = new Consent();
    await consentManager.getError();

Was this helpful?

/