Mintplex-Labs/anything-llm · error · Error

No token provided.

Error message

No token provided.

What it means

The Simple SSO passthrough page reads the token from the URL query string; if ?token= is absent it throws 'No token provided.' before System.simpleSSOLogin is ever called. This is a deliberate client-side guard: the page is only ever entered via a link that must carry the token.

Source

Thrown at frontend/src/pages/Login/SSO/simple.jsx:16

import React, { useEffect, useState } from "react";
import { FullScreenLoader } from "@/components/Preloader";
import paths from "@/utils/paths";
import useQuery from "@/hooks/useQuery";
import System from "@/models/system";
import { AUTH_TIMESTAMP, AUTH_TOKEN, AUTH_USER } from "@/utils/constants";

export default function SimpleSSOPassthrough() {
  const query = useQuery();
  const redirectPath = query.get("redirectTo") || paths.home();
  const [ready, setReady] = useState(false);
  const [error, setError] = useState(null);

  useEffect(() => {
    try {
      if (!query.get("token")) throw new Error("No token provided.");

      // Clear any existing auth data
      window.localStorage.removeItem(AUTH_USER);
      window.localStorage.removeItem(AUTH_TOKEN);
      window.localStorage.removeItem(AUTH_TIMESTAMP);

      System.simpleSSOLogin(query.get("token"))
        .then((res) => {
          if (!res.valid) throw new Error(res.message);

          window.localStorage.setItem(AUTH_USER, JSON.stringify(res.user));
          window.localStorage.setItem(AUTH_TOKEN, res.token);
          window.localStorage.setItem(AUTH_TIMESTAMP, Number(new Date()));
          setReady(res.valid);
        })
        .catch((e) => {
          setError(e.message);
        });

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Use the complete SSO link including ?token=<jwt> exactly as generated by the auth provider.
  2. Verify no proxy or redirect in the chain strips query parameters.
  3. Confirm simple SSO mode is enabled in system settings so the token is actually minted on the upstream side.
Defensive patterns

Strategy: validation

Validate before calling

const params = new URLSearchParams(window.location.search);
const token = params.get('token');
if (!token) {
  // Redirect to the standard login instead of throwing mid-effect
  window.location.replace(paths.login());
}

Type guard

function isNonEmptyToken(value) {
  return typeof value === 'string' && value.trim().length > 0;
}

Try / catch

try {
  if (!isNonEmptyToken(query.get('token'))) throw new Error('No token provided.');
  // proceed with simpleSSOLogin
} catch (error) {
  setError(error.message);
}

Prevention

When it happens

Trigger: Navigating to the simple SSO route without a token query parameter; the IdP-generated link omitted ?token=; a redirect or reverse proxy stripping query parameters before the page loads.

Common situations: Bookmarked SSO deep link without the token; proxy rewriting that drops query strings; simple SSO provider misconfigured so it never appends the token to the redirect.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/753fbb32bea06ed9. Report an issue: GitHub.