Backend Studio (BaaS)App Auth & Users
Auth & RBACBackend Studio (BaaS)•7 min read•Updated November 2026

App Auth: Complete End-User Authentication & Role-Based Access Control

App Auth delivers turnkey user management for apps built on Apps Manager. Provision user accounts, verify credentials with secure bcrypt hashing, issue JWT access & refresh tokens, enforce Role-Based Access Control (RBAC), and manage end-user sessions from the dashboard.

Jump to:

Overview & Architecture

Building auth from scratch means implementing password hashing, JWT generation, token refresh rotations, password reset emails, and RBAC middleware. App Auth provides ready-to-use endpoints scoped specifically to your App Public ID at /apps/:appPublicId/auth. Your frontend or mobile app can register users, log them in, inspect profile sessions, and control access permissions effortlessly.

Core Capabilities

Isolated User Directory: Each App container maintains its own isolated database of registered end-users.
Secure Password Hashing: Industry-standard bcrypt salt rounds ensure passwords are never stored in plaintext.
JWT Bearer Sessions: Secure access tokens and refresh tokens allow seamless client-side authentication and session recovery.
Role-Based Access Control (RBAC): Assign roles (e.g., user, admin, editor, premium) to restrict access to database collections or custom APIs.
Dashboard User Management: Inspect registered users, ban abusive accounts, view last login timestamps, and trigger password resets.
Custom User Metadata: Store custom application attributes (display name, avatar URL, preferences, subscription status) directly in the user profile.

Detailed Implementation Guides

1Authentication Endpoints & Data Contracts

App Auth endpoints are exposed at /apps/:appPublicId/auth/ and require no backend server setup.

Securing Database Collections with Auth

You can bind Database Collections to App Auth in Backend Studio! Configure collections to allow "Public Read, Authenticated Write", or "Owner Only" so users can only view and modify their own records.

ActionMethod & PathPayload / HeadersResult
Sign UpPOST .../auth/register{ email, password, name, metadata }Creates user account and returns JWT token + user profile
Sign InPOST .../auth/login{ email, password }Validates credentials and returns JWT token + user profile
Get ProfileGET .../auth/meAuthorization: Bearer <USER_JWT>Returns authenticated user information and active role
Refresh TokenPOST .../auth/refresh{ refreshToken }Issues fresh JWT access token without forcing user re-login
Forgot PasswordPOST .../auth/forgot-password{ email }Generates password reset token and dispatches reset instructions
Reset PasswordPOST .../auth/reset-password{ token, newPassword }Applies new password and invalidates previous sessions

REST API Reference

POST/apps/:appPublicId/auth/register
Public

Register a new end-user account with email, password, and custom attributes

POST/apps/:appPublicId/auth/login
Public

Authenticate an existing user with email and password

GET/apps/:appPublicId/auth/me
Bearer JWT

Retrieve currently authenticated user session details

Production Code Integration

React Authentication Hook (useAppAuth.ts)
import { useState, useEffect, createContext, useContext } from 'react';

const BASE_URL = 'https://apps-manager.in';
const APP_PUBLIC_ID = 'app_pub_789456';

interface User {
  _id: string;
  email: string;
  name: string;
  role: string;
}

export function useAppAuth() {
  const [user, setUser] = useState<User | null>(null);
  const [token, setToken] = useState<string | null>(() => localStorage.getItem('am_user_token'));
  const [loading, setLoading] = useState(true);

  // Check existing session
  useEffect(() => {
    async function fetchMe() {
      if (!token) {
        setLoading(false);
        return;
      }
      try {
        const res = await fetch(`${BASE_URL}/apps/${APP_PUBLIC_ID}/auth/me`, {
          headers: { 'Authorization': `Bearer ${token}` },
        });
        if (res.ok) {
          const data = await res.json();
          setUser(data.user);
        } else {
          logout();
        }
      } catch (err) {
        logout();
      } finally {
        setLoading(false);
      }
    }
    fetchMe();
  }, [token]);

  const login = async (email: string, password: string) => {
    const res = await fetch(`${BASE_URL}/apps/${APP_PUBLIC_ID}/auth/login`, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ email, password }),
    });
    const data = await res.json();
    if (!res.ok) throw new Error(data.message || 'Login failed');

    localStorage.setItem('am_user_token', data.token);
    setToken(data.token);
    setUser(data.user);
    return data.user;
  };

  const logout = () => {
    localStorage.removeItem('am_user_token');
    setToken(null);
    setUser(null);
  };

  return { user, token, loading, login, logout };
}

Frequently Asked Questions

Can end-users see or access data from other Apps?

No. Users registered under App A cannot authenticate or access resources in App B. All user tables, tokens, and sessions are strictly scoped by App Public ID.

How long do user JWT tokens remain valid?

Access tokens expire after 7 days by default, while refresh tokens can be configured for 30 days. When an access token expires, the client can call the refresh endpoint to obtain a new token transparently.

Start Building with Apps Manager Today

Build databases, create scraping APIs, convert websites to JSON, and issue Ed25519 cryptographic software licenses in minutes. Zero credit card required.

Get Started Free