Customized Consent screen class

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

Import and instantiate the Customized Consent screen class:

import CustomizedConsent from '@auth0/auth0-acul-js/customized-consent';
const customizedconsentManager = new CustomizedConsent();

Was this helpful?

/

Properties

The Customized 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 Customized Consent screen class methods are:

accept( options? )

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

import CustomizedConsent from '@auth0/auth0-acul-js/customized-consent';
const customizedConsentManager = new CustomizedConsent();
const handleAccept = async () => {
 try {
   await customizedConsentManager.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 CustomizedConsent from '@auth0/auth0-acul-js/customized-consent';
const customizedConsentManager = new CustomizedConsent();
const handleDeny = async () => {
try {
    await customizedConsentManager.deny({ denial_reason: "user_declined" });
    // On success, Auth0 will typically redirect.
  } catch (e) {
    console.error('Failed to deny consent:', e);
  }
 }

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 CustomizedConsent from '@auth0/auth0-acul-js/customized-consent';
    const customizedConsentManager = new CustomizedConsent();
    await customizedConsentManager.getError();

Was this helpful?

/