RegisterLogin
DocsPricing
RegisterLogin
  • Getting Started
  • Introduction
  • Quick Start
  • SDKs
  • React
  • TypeScript
  • Next.js
  • Express
  • NestJS
  • Python
  • API Reference
  • Support and Resources
  • FAQ
  • Contact Support

AuthSafe

Product

HighlightFeatureIntegrationPricingFAQ

Company

AboutBlogContactSitemap

Developer

DashboardDocumentation

Legal

Terms & ConditionsPrivacyComplianceShippingCancellation

© 2026 AuthSafe. All rights reserved.

We value your privacy

This website uses cookies for anonymous analytics to help us improve your experience. No personal information is stored or shared. You can allow or reject analytics tracking at any time. See our Privacy Policy.

We use cookies for anonymous analytics. No personal info is stored. See our Privacy Policy.

BrandingApi

API client for fetching application branding and theme settings.

Overview

The BrandingApi retrieves customized branding configuration from the AuthSafe server, including logos, colors, and theme settings.
Public Endpoint
Branding endpoints are public and do not require authentication. You can fetch branding data without an access token.

Constructor

import { HttpService, BrandingApi } from 'authsafe-ts';

// No authentication required
const httpService = new HttpService();
const brandingApi = new BrandingApi(httpService);

Methods

Get Branding

Fetch branding configuration for a specific client.
await brandingApi.getBranding(clientId: string): Promise<BrandingConfig>
Returns:
interface BrandingConfig {
  logo: string; // Logo URL
  favicon: string; // Favicon URL
  primary_color: string; // Primary brand color (hex)
  secondary_color: string; // Secondary color (hex)
  background_color: string; // Background color (hex)
  text_color: string; // Text color (hex)
  company_name: string; // Company name
  support_email?: string; // Support email
  privacy_url?: string; // Privacy policy URL
  terms_url?: string; // Terms of service URL
}
Example:
const branding = await brandingApi.getBranding('your-client-id');

console.log('Logo:', branding.logo);
console.log('Primary color:', branding.primary_color);

Complete Examples

Apply Branding to Login Page

import { HttpService, BrandingApi } from 'authsafe-ts';

async function applyBranding() {
  const httpService = new HttpService();
  const brandingApi = new BrandingApi(httpService);

  const clientId = 'your-client-id';
  const branding = await brandingApi.getBranding(clientId);

  // Apply logo
  document.getElementById('app-logo').src = branding.logo;

  // Apply colors
  document.documentElement.style.setProperty(
    '--primary-color',
    branding.primary_color,
  );
  document.documentElement.style.setProperty(
    '--secondary-color',
    branding.secondary_color,
  );
  document.documentElement.style.setProperty(
    '--bg-color',
    branding.background_color,
  );

  // Apply company name
  document.getElementById('company-name').textContent = branding.company_name;

  // Update favicon
  const favicon = document.querySelector('link[rel="icon"]');
  favicon.href = branding.favicon;
}

// Apply on page load
applyBranding();

Dynamic Theme Generation

import { HttpService, BrandingApi } from 'authsafe-ts';

async function generateTheme(clientId: string) {
  const httpService = new HttpService();
  const brandingApi = new BrandingApi(httpService);

  const branding = await brandingApi.getBranding(clientId);

  return {
    palette: {
      primary: {
        main: branding.primary_color,
      },
      secondary: {
        main: branding.secondary_color,
      },
      background: {
        default: branding.background_color,
      },
      text: {
        primary: branding.text_color,
      },
    },
    typography: {
      fontFamily: '"Inter", "Roboto", "Helvetica", "Arial", sans-serif',
    },
    components: {
      MuiButton: {
        styleOverrides: {
          root: {
            textTransform: 'none',
          },
        },
      },
    },
  };
}

// Use with Material-UI
const theme = createTheme(await generateTheme('your-client-id'));

Vanilla JavaScript Example

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>My App</title>
    <link rel="icon" type="image/png" id="favicon" href="/favicon.png" />
    <style>
      :root {
        --primary-color: #007bff;
        --secondary-color: #6c757d;
        --bg-color: #ffffff;
        --text-color: #212529;
      }

      body {
        background-color: var(--bg-color);
        color: var(--text-color);
        font-family: Arial, sans-serif;
      }

      .btn-primary {
        background-color: var(--primary-color);
        color: white;
        padding: 10px 20px;
        border: none;
        border-radius: 4px;
      }

      #app-logo {
        max-width: 200px;
        height: auto;
      }
    </style>
  </head>
  <body>
    <img id="app-logo" src="/default-logo.png" alt="App Logo" />
    <h1 id="company-name">My App</h1>
    <button class="btn-primary">Sign In</button>

    <script type="module">
      import { HttpService, BrandingApi } from 'authsafe-ts';

      async function init() {
        const httpService = new HttpService();
        const brandingApi = new BrandingApi(httpService);
        const branding = await brandingApi.getBranding('your-client-id');

        // Apply branding
        document.getElementById('app-logo').src = branding.logo;
        document.getElementById('company-name').textContent =
          branding.company_name;
        document.getElementById('favicon').href = branding.favicon;

        document.documentElement.style.setProperty(
          '--primary-color',
          branding.primary_color,
        );
        document.documentElement.style.setProperty(
          '--secondary-color',
          branding.secondary_color,
        );
        document.documentElement.style.setProperty(
          '--bg-color',
          branding.background_color,
        );
        document.documentElement.style.setProperty(
          '--text-color',
          branding.text_color,
        );
      }

      init();
    </script>
  </body>
</html>

Use Cases

  • Custom login pages - Apply tenant branding to authentication UI
  • Multi-tenant applications - Show different branding per client
  • White-label solutions - Fully branded authentication experience
  • Dynamic theming - Runtime theme generation based on client

Related

  • OAuthService - Authentication
  • HttpService - HTTP client
  • Type Definitions - Branding types