{"record":{"id":"753fbb32bea06ed9","repo":"Mintplex-Labs/anything-llm","slug":"no-token-provided","errorCode":null,"errorMessage":"No token provided.","messagePattern":"No token provided\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/pages/Login/SSO/simple.jsx","lineNumber":16,"sourceCode":"import React, { useEffect, useState } from \"react\";\nimport { FullScreenLoader } from \"@/components/Preloader\";\nimport paths from \"@/utils/paths\";\nimport useQuery from \"@/hooks/useQuery\";\nimport System from \"@/models/system\";\nimport { AUTH_TIMESTAMP, AUTH_TOKEN, AUTH_USER } from \"@/utils/constants\";\n\nexport default function SimpleSSOPassthrough() {\n  const query = useQuery();\n  const redirectPath = query.get(\"redirectTo\") || paths.home();\n  const [ready, setReady] = useState(false);\n  const [error, setError] = useState(null);\n\n  useEffect(() => {\n    try {\n      if (!query.get(\"token\")) throw new Error(\"No token provided.\");\n\n      // Clear any existing auth data\n      window.localStorage.removeItem(AUTH_USER);\n      window.localStorage.removeItem(AUTH_TOKEN);\n      window.localStorage.removeItem(AUTH_TIMESTAMP);\n\n      System.simpleSSOLogin(query.get(\"token\"))\n        .then((res) => {\n          if (!res.valid) throw new Error(res.message);\n\n          window.localStorage.setItem(AUTH_USER, JSON.stringify(res.user));\n          window.localStorage.setItem(AUTH_TOKEN, res.token);\n          window.localStorage.setItem(AUTH_TIMESTAMP, Number(new Date()));\n          setReady(res.valid);\n        })\n        .catch((e) => {\n          setError(e.message);\n        });","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/frontend/src/pages/Login/SSO/simple.jsx#L1-L34","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use the complete SSO link including ?token=<jwt> exactly as generated by the auth provider.","Verify no proxy or redirect in the chain strips query parameters.","Confirm simple SSO mode is enabled in system settings so the token is actually minted on the upstream side."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const params = new URLSearchParams(window.location.search);\nconst token = params.get('token');\nif (!token) {\n  // Redirect to the standard login instead of throwing mid-effect\n  window.location.replace(paths.login());\n}","typeGuard":"function isNonEmptyToken(value) {\n  return typeof value === 'string' && value.trim().length > 0;\n}","tryCatchPattern":"try {\n  if (!isNonEmptyToken(query.get('token'))) throw new Error('No token provided.');\n  // proceed with simpleSSOLogin\n} catch (error) {\n  setError(error.message);\n}","preventionTips":["Only enter the simple SSO route from provider-generated links that carry ?token=.","Ensure proxies and redirects in the auth chain preserve query parameters.","Give users a manual 'continue to login' fallback when the token is absent."],"tags":["sso","auth","missing-token","query-params"],"backgroundTag":"missing-auth-token","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}