Files
3x-ui/docs/content/docs/fa/reference/api/authentication.mdx
MHSanaei 9b91f0f42e docs: vendor the documentation site into the monorepo
Fold the standalone 3x-ui-docs project (Next.js 16 + Fumadocs, deployed to
docs.sanaei.dev) into docs/ so the panel and its documentation share a single
source of truth, the way sing-box keeps its docs in-tree. The old repo becomes
redundant and can be retired.

- Import the full site under docs/ (app, components, content, lib, public,
  scripts, config). The self-contained pnpm project sits alongside the existing
  engineering notes with no filename collisions.
- Re-point "Edit on GitHub" links from MHSanaei/3x-ui-docs to this repo's
  docs/content/docs path (docs/lib/shared.ts, docs/app/.../page.tsx).
- Add docs-ci.yml and docs-deploy.yml under .github/workflows/, scoped to
  docs/** and run with working-directory: docs, since GitHub only runs
  workflows from the repo-root .github/. deploy-static.yml's GitHub Pages
  publish (CNAME docs.sanaei.dev) carries over unchanged.

Follow-up (outside this commit): attach the docs.sanaei.dev custom domain to
this repository's Pages (or set the Vercel project's root directory to docs),
confirm the site is live from the monorepo, then delete MHSanaei/3x-ui-docs.
2026-07-07 23:07:14 +02:00

75 lines
4.8 KiB
Plaintext

---
title: احراز هویت
description: >-
دو حالت احراز هویت پشتیبانی می‌شود. نشست‌های UI از یک کوکی استفاده می‌کنند که
توسط نقطه‌پایانی ورود تنظیم می‌شود. کلاینت‌های برنامه‌نویسی‌شده (ربات‌ها،
اسکریپت‌ها، پنل‌های راه دور) با یک توکن Bearer که از مسیر Settings → Security →
API Token گرفته می‌شود احراز هویت می‌کنند. هر دو روش برای همهٔ نقاط‌پایانی زیر
/panel/api/* کار می‌کنند.
full: true
_openapi:
preload:
- ./public/openapi.json
toc:
- depth: 2
title: >-
با نام کاربری + رمز عبور احراز هویت کنید و یک کوکی نشست دریافت کنید.
پیش از هر فراخوانی API مبتنی بر کوکی الزامی است.
url: >-
#authenticate-with-username--password-and-receive-a-session-cookie-required-before-any-cookie-based-api-call
- depth: 2
title: کوکی نشست را پاک می‌کند. برای نشست‌های مرورگر به هدر CSRF نیاز دارد.
url: '#clear-the-session-cookie-requires-the-csrf-header-for-browser-sessions'
- depth: 2
title: >-
یک توکن CSRF برای نشست جاری صادر می‌کند. SPA آن را در هدر X-CSRF-Token
روی درخواست‌های ناامن بازپخش می‌کند. فراخوانندگانی که از توکن Bearer
استفاده می‌کنند می‌توانند از این مرحله صرف‌نظر کنند — میان‌افزار برای
درخواست‌های API احراز هویت‌شده CSRF را دور می‌زند.
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
- depth: 2
title: >-
مشخص می‌کند که آیا 2FA روی پنل فعال است یا خیر — صفحهٔ ورود از آن برای
تصمیم‌گیری دربارهٔ نمایش فیلد OTP استفاده می‌کند.
url: >-
#returns-whether-2fa-is-enabled-on-the-panel--used-by-the-login-page-to-decide-whether-to-show-the-otp-field
structuredData:
headings:
- content: >-
با نام کاربری + رمز عبور احراز هویت کنید و یک کوکی نشست دریافت کنید.
پیش از هر فراخوانی API مبتنی بر کوکی الزامی است.
id: >-
authenticate-with-username--password-and-receive-a-session-cookie-required-before-any-cookie-based-api-call
- content: >-
کوکی نشست را پاک می‌کند. برای نشست‌های مرورگر به هدر CSRF نیاز
دارد.
id: clear-the-session-cookie-requires-the-csrf-header-for-browser-sessions
- content: >-
یک توکن CSRF برای نشست جاری صادر می‌کند. SPA آن را در هدر X-CSRF-Token
روی درخواست‌های ناامن بازپخش می‌کند. فراخوانندگانی که از توکن Bearer
استفاده می‌کنند می‌توانند از این مرحله صرف‌نظر کنند — میان‌افزار برای
درخواست‌های API احراز هویت‌شده CSRF را دور می‌زند.
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
- content: >-
مشخص می‌کند که آیا 2FA روی پنل فعال است یا خیر — صفحهٔ ورود از آن
برای تصمیم‌گیری دربارهٔ نمایش فیلد OTP استفاده می‌کند.
id: >-
returns-whether-2fa-is-enabled-on-the-panel--used-by-the-login-page-to-decide-whether-to-show-the-otp-field
contents: []
---
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
export default function Layout(props) {
const { APIPage, OpenAPIPage } = props.components ?? {};
// "APIPage" is the old name from v10, this allows both for backward compatibility
const Comp = OpenAPIPage ?? APIPage;
return (
<>
{props.children}
<Comp document="./public/openapi.json" webhooks={[]} operations={[{"path":"/login","method":"post"},{"path":"/logout","method":"post"},{"path":"/csrf-token","method":"get"},{"path":"/getTwoFactorEnable","method":"post"}]} showTitle />
</>
);
}