Client Libraries Overview
Authava provides client libraries for popular frameworks and platforms to make integration with your applications as seamless as possible. These libraries handle the authentication flow, token management, and API communication for you.
Available Client Libraries
React Client
The React client provides components and hooks for adding authentication to React applications:
- Easy integration with React Router
- Pre-built login and signup components
- Authentication state management
- Protected routes
import { AuthavaProvider, useAuthava } from '@authava/react';
function App() {
return (
<AuthavaProvider
domain="auth.yourdomain.com"
clientId="your-client-id"
redirectUri={window.location.origin}
>
<YourApp />
</AuthavaProvider>
);
}
Spring Client
The Spring client provides integration with Spring Boot applications:
- Spring Security integration
- JWT token validation
- Authentication filters
- User details service
@EnableAuthava
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Laravel Client
The Laravel client provides integration with Laravel applications:
- Laravel Auth integration
- Middleware for protected routes
- Blade directives for authentication
- Artisan commands for setup
// config/auth.php
'guards' => [
'web' => [
'driver' => 'authava',
'provider' => 'users',
],
],
FastAPI Client
The FastAPI client provides integration with FastAPI applications:
- Dependency injection for authentication
- JWT token validation
- Role-based access control
- Middleware for protected routes
from fastapi import FastAPI, Depends
from authava.fastapi import AuthavaAuth, get_current_user
app = FastAPI()
auth = AuthavaAuth()
@app.get("/protected")
def protected_route(user = Depends(get_current_user)):
return {"message": f"Hello, {user.name}!"}
Terraform Provider
The Terraform provider allows you to manage Authava resources as code:
- Domain management
- Email configuration
- Social provider setup
- User management
resource "authava_domain" "example" {
domain = "auth.example.com"
email_provider = "authava"
}
resource "authava_social_provider" "github" {
domain_id = authava_domain.example.id
provider_type = "github"
client_id = var.github_client_id
client_secret = var.github_client_secret
}
Choosing the Right Client
The client library you choose depends on your application's technology stack:
- Frontend Applications: Use the React client for React applications
- Backend Applications: Choose the client that matches your backend framework (Spring, Laravel, FastAPI)
- Infrastructure as Code: Use the Terraform provider for automated deployments
Common Features
All client libraries provide these core features:
- Authentication: Login, logout, and signup functionality
- Token Management: Secure storage and renewal of authentication tokens
- User Information: Access to authenticated user details
- Protected Resources: Mechanisms to protect routes or endpoints
Getting Started
To get started with a client library:
- Choose the client that matches your technology stack
- Follow the installation instructions for your chosen client
- Configure the client with your Authava domain and client ID
- Implement authentication in your application