This guide will help you integrate Authiqa authentication into your application.

Prerequisites

  • An Authiqa account
  • Your public key
  • A web application where you want to add authentication

Integration Steps

1

Add Container and Widget Script

<!-- Add the container div -->
<div id="authiqa"></div>

<!-- Add the widget script -->
<script 
src="https://widget.authiqa.com"
    defer
    data-public-key="YOUR_PUBLIC_KEY"
    action="signin"
></script>
The action attribute can be: signin, signup, reset, update, verify, or resend
2

Configure Theme (Optional)

<!-- Dark theme -->
<script 
    defer
    src="https://widget.authiqa.com"
    data-public-key="YOUR_PUBLIC_KEY"
    action="signin"
    theme="dark"
></script>

<!-- Custom styling -->
<script 
    defer
    src="https://widget.authiqa.com"
    data-public-key="YOUR_PUBLIC_KEY"
    action="signin"
    disable-styles="true"
></script>
3

Handle Authentication Events

// Success events
widget.on('widget:success', (data) => {
  console.log('Authentication successful:', data);
  // Tokens are automatically stored in localStorage:
  // - authiqa_token: JWT access token
  // - authiqa_token_expiration: Token expiration
  // - authiqa_parent_jwt_secret: Parent JWT secret
});

// Error events  
widget.on('widget:error', (error) => {
  console.error('Authentication failed:', error);
});

// Verification events
widget.on('verify:success', () => {
  console.log('Email verification successful');
});

Widget Events

The widget emits several events you can listen for:
  • auth:success - Authentication successful
  • auth:error - Authentication failed
  • verify:success - Email verification successful
  • verify:error - Email verification failed

Verification

Test your integration by:
  1. Opening your application
  2. Clicking the login button
  3. Completing the authentication flow

Need detailed setup?

Check our complete widget setup guide

Next Steps