authentication.mdx 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. ---
  2. title: Authentication
  3. description: Two authentication modes are supported. UI sessions use a cookie
  4. set by the login endpoint. Programmatic clients (bots, scripts, remote panels)
  5. authenticate with a Bearer token taken from Settings → Security → API Token.
  6. Both work for every endpoint under /panel/api/*.
  7. full: true
  8. _openapi:
  9. preload:
  10. - ./public/openapi.json
  11. toc:
  12. - depth: 2
  13. title: Authenticate with username + password and receive a session cookie.
  14. Required before any cookie-based API call.
  15. url: '#authenticate-with-username--password-and-receive-a-session-cookie-required-before-any-cookie-based-api-call'
  16. - depth: 2
  17. title: Clear the session cookie. Requires the CSRF header for browser sessions.
  18. url: '#clear-the-session-cookie-requires-the-csrf-header-for-browser-sessions'
  19. - depth: 2
  20. title: Mint a CSRF token for the current session. The SPA replays it in the
  21. X-CSRF-Token header on unsafe requests. Bearer-token callers can skip
  22. this — the middleware short-circuits CSRF for authenticated API
  23. requests.
  24. url: '#mint-a-csrf-token-for-the-current-session-the-spa-replays-it-in-the-x-csrf-token-header-on-unsafe-requests-bearer-token-callers-can-skip-this--the-middleware-short-circuits-csrf-for-authenticated-api-requests'
  25. - depth: 2
  26. title: Public. Active paid sponsor placements read from the project
  27. sponsors.json (cached for 1h); entries outside their from/until window
  28. are dropped. Logos are proxied by the panel at /sponsors/logo/{name}.
  29. Used by the login page and panel sponsor slots.
  30. url: '#public-active-paid-sponsor-placements-read-from-the-project-sponsorsjson-cached-for-1h-entries-outside-their-fromuntil-window-are-dropped-logos-are-proxied-by-the-panel-at-sponsorslogoname-used-by-the-login-page-and-panel-sponsor-slots'
  31. - depth: 2
  32. title: Returns whether 2FA is enabled on the panel — used by the login page to
  33. decide whether to show the OTP field.
  34. url: '#returns-whether-2fa-is-enabled-on-the-panel--used-by-the-login-page-to-decide-whether-to-show-the-otp-field'
  35. structuredData:
  36. headings:
  37. - content: Authenticate with username + password and receive a session cookie.
  38. Required before any cookie-based API call.
  39. id: authenticate-with-username--password-and-receive-a-session-cookie-required-before-any-cookie-based-api-call
  40. - content: Clear the session cookie. Requires the CSRF header for browser
  41. sessions.
  42. id: clear-the-session-cookie-requires-the-csrf-header-for-browser-sessions
  43. - content: Mint a CSRF token for the current session. The SPA replays it in the
  44. X-CSRF-Token header on unsafe requests. Bearer-token callers can skip
  45. this — the middleware short-circuits CSRF for authenticated API
  46. requests.
  47. id: mint-a-csrf-token-for-the-current-session-the-spa-replays-it-in-the-x-csrf-token-header-on-unsafe-requests-bearer-token-callers-can-skip-this--the-middleware-short-circuits-csrf-for-authenticated-api-requests
  48. - content: Public. Active paid sponsor placements read from the project
  49. sponsors.json (cached for 1h); entries outside their from/until window
  50. are dropped. Logos are proxied by the panel at /sponsors/logo/{name}.
  51. Used by the login page and panel sponsor slots.
  52. id: public-active-paid-sponsor-placements-read-from-the-project-sponsorsjson-cached-for-1h-entries-outside-their-fromuntil-window-are-dropped-logos-are-proxied-by-the-panel-at-sponsorslogoname-used-by-the-login-page-and-panel-sponsor-slots
  53. - content: Returns whether 2FA is enabled on the panel — used by the login page to
  54. decide whether to show the OTP field.
  55. id: returns-whether-2fa-is-enabled-on-the-panel--used-by-the-login-page-to-decide-whether-to-show-the-otp-field
  56. contents: []
  57. ---
  58. {/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
  59. export default function Layout(props) {
  60. const { APIPage, OpenAPIPage } = props.components ?? {};
  61. // "APIPage" is the old name from v10, this allows both for backward compatibility
  62. const Comp = OpenAPIPage ?? APIPage;
  63. return (
  64. <>
  65. {props.children}
  66. <Comp document="./public/openapi.json" webhooks={[]} operations={[{"path":"/login","method":"post"},{"path":"/logout","method":"post"},{"path":"/csrf-token","method":"get"},{"path":"/sponsors","method":"get"},{"path":"/getTwoFactorEnable","method":"post"}]} showTitle />
  67. </>
  68. );
  69. }