AutherBeta
Documentation

Quick Start

Get Auther running in your app in under 5 minutes — frontend auth modal and a protected backend route.

1

Create a project & grab your keys

Sign in to the Auther dashboard, create a project, then go to API Keys and copy your Client ID and Client Secret.

2

Install the packages

bash
# React / Next.js — use the React SDK (includes frontend SDK)
npm install @auther-sdk/react

# Vanilla JS / any other framework
npm install @auther-sdk/frontend

# Your server / API
npm install @auther-sdk/node
3

Add auth to your app

React / Next.js — wrap your app in <AutherProvider>:

tsx
import { AutherProvider } from '@auther-sdk/react';

export default function Layout({ children }) {
  return (
    <AutherProvider
      clientId="req_live_xxxxxxxxxxxxxxxx"
      endpoint="https://your-auther-endpoint/api/v1"
    >
      {children}
    </AutherProvider>
  );
}

// In any component:
import { useAuther } from '@auther-sdk/react';

function Navbar() {
  const { user, login, logout } = useAuther();
  return user
    ? <button onClick={logout}>Log out</button>
    : <button onClick={login}>Log in</button>;
}

Vanilla JS — call init() once on page load:

typescript
import Auther from '@auther-sdk/frontend';

Auther.init({
  clientId: 'req_live_xxxxxxxxxxxxxxxx',
  onAuth: (user) => {
    if (user) loadApp(user);
    else showLanding();
  },
});

Auther.mount('#login-btn');
4

Protect a route on your server

typescript
import express from 'express';
import cookieParser from 'cookie-parser';
import { Auther } from '@auther-sdk/node';

const app    = express();
const auther = new Auther({
  clientId:     'req_live_xxxxxxxxxxxxxxxx',
  clientSecret: 'sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
});

app.use(express.json());
app.use(cookieParser());

app.get('/me', auther.protect(), (req, res) => {
  res.json({ user: req.autherUser });
});

app.listen(3001);

That's it

Your users can now sign up, log in, and your backend verifies their identity on every request. Token rotation and refresh happen automatically.