How to Retrieve Branding and Other Universal Login Context Information Using ACUL in Auth0

Overview

Auth0 fails to retrieve branding information in Advanced Customizations for Universal Login (ACUL) when an application does not access the injected configuration context correctly. This occurs because Auth0 injects the branding settings directly into the ACUL context rather than providing them through standard API calls. Implement the useBranding() or other hooks provided by the Auth0 ACUL React Software Development Kit (SDK) to access the strictly typed branding settings and resolve the issue.

Applies To

  • Advanced Customization for Universal Login (ACUL)
  • React Software Development Kit (SDK)
  • Branding

Solution

How does the application retrieve branding information in Custom Universal Login?

To retrieve the branding information, import the useBranding hook from the Auth0 ACUL React SDK and extract the required settings by following these steps:

  1. Open the React application codebase.
  2. Import the useBranding hook from the @auth0/auth0-acul-react package.
  3. Call the useBranding() hook within the component to access the parsed context payload.
  4. Extract the required branding properties, such as the logo URL and primary colors, from the branding.settings object.
  5. Implement the following code snippet to apply the branding settings to the component.
    import React from 'react';
    import { useBranding } from '@auth0/auth0-acul-react'; 
    
    export const CustomHeader = () => {
      const branding = useBranding();
      
      const logoUrl = branding?.settings?.logoUrl;
      const primaryColor = branding?.settings?.colors?.primary;
      const pageBackground = branding?.settings?.colors?.pageBackground;
    
      return (
        <div style={{ backgroundColor: pageBackground, padding: '20px' }}>
          {logoUrl && (
            <img 
              src={logoUrl} 
              alt="Company Logo" 
              style={{ maxWidth: '150px', marginBottom: '20px' }} 
            />
          )}
          
          <h1 style={{ color: primaryColor }}>
            Welcome to Our App
          </h1>
        </div>
      );
    };
 
  1. Save and deploy the updated application code.

Related References

Recommended content

No recommended content found...