{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/vi/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["img"]},"type":"markdown"},"seo":{"title":"Xác thực","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"xác-thực","__idx":0},"children":["Xác thực"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["MoreLogin sử dụng các phương thức xác thực khác nhau cho hai loại API của nó."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"xác-thực-api-cục-bộ","__idx":1},"children":["Xác thực API cục bộ"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["API cục bộ chạy trên ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http://127.0.0.1:40000"]}," và chỉ có thể truy cập được từ máy cục bộ."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"chế-độ-mặc-định-không-xác-thực","__idx":2},"children":["Chế độ mặc định (Không xác thực)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Theo mặc định, API cục bộ không yêu cầu xác thực. Bạn có thể thực hiện yêu cầu trực tiếp:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST http://127.0.0.1:40000/api/env/page \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"pageNo\": 1,\n    \"pageSize\": 10\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"kích-hoạt-xác-thực","__idx":3},"children":["Kích hoạt xác thực"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Để tăng cường bảo mật, bạn có thể bật xác thực API cục bộ trong ứng dụng khách MoreLogin:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Mở ứng dụng khách MoreLogin"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Điều hướng đến ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Cài đặt"]}," → ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["API & MCP"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Bật ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Xác thực API cục bộ"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Sao chép mã thông báo ủy quyền đã tạo"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image.590455fe8c04c7aec45454ddba2524af46ee8128e15fbef43221c071f4863f91.b19fd103.png","alt":"Bật xác thực API cục bộ"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Sau khi bật, hãy bao gồm tiêu đề ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization"]}," trong tất cả các yêu cầu:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST http://127.0.0.1:40000/api/env/page \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: YOUR_AUTH_TOKEN\" \\\n  -d '{\n    \"pageNo\": 1,\n    \"pageSize\": 10\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Lưu ý bảo mật"]},": API cục bộ chỉ khả dụng trên ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["localhost"]},". Nó không thể được truy cập từ xa."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"xác-thực-api-mở-oauth2","__idx":4},"children":["Xác thực API mở (OAuth2)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["API mở sử dụng luồng thông tin xác thực ứng dụng khách OAuth2 để xác thực các yêu cầu."]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Điểm cuối máy chủ API mở: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.morelogin.com"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"bước-1-nhận-id-api-và-khóa-api","__idx":5},"children":["Bước 1: Nhận ID API và khóa API"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Mở ứng dụng khách MoreLogin"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Điều hướng đến ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Cài đặt"]}," → ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["API & MCP"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Sao chép ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["ID API"]}," và ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Khóa API"]}]}]},{"$$mdtype":"Tag","name":"Image","attributes":{"src":"/assets/image.5fd3488a120b7d8e2f400229cb0ad75e34ad8299fa6cfc9c304c29662ff9ade1.25b9c730.png","alt":"ID và khóa API","withLightbox":true,"width":"","height":""},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"bước-2-nhận-mã-thông-báo-truy-cập","__idx":6},"children":["Bước 2: Nhận mã thông báo truy cập"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Trao đổi ID API và Khóa API của bạn để lấy mã thông báo truy cập:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST https://api.morelogin.com/oauth2/token \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"client_id\": \"YOUR_API_ID\",\n    \"client_secret\": \"YOUR_API_KEY\",\n    \"grant_type\": \"client_credentials\"\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Phản hồi mẫu:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"code\": 0,\n    \"msg\": null,\n    \"data\": {\n        \"scope\": \"cloudphone\",\n        \"access_token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOi...\",\n        \"token_type\": \"Bearer\",\n        \"expires_in\": 3600,\n        \"client_metadata\": {\n            \"name\": \"Example Team\"\n        }\n    },\n    \"requestId\": \"4b727b1d53a445d0a46389465b562360\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"bước-3-sử-dụng-mã-thông-báo-truy-cập","__idx":7},"children":["Bước 3: Sử dụng mã thông báo truy cập"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Bao gồm mã thông báo truy cập trong tiêu đề ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization"]}," cho tất cả yêu cầu API mở:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST https://api.morelogin.com/cloudphone/app/page \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_ACCESS_TOKEN\" \\\n  -d '{\n    \"pageNum\": 1,\n    \"pageSize\": 10\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Lưu ý"]},": Mã truy cập hết hạn sau ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["3600 giây"]}," (1 giờ). Yêu cầu mã thông báo mới khi mã thông báo hiện tại hết hạn."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"so-sánh-xác-thực","__idx":8},"children":["So sánh xác thực"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"tính năng"},"children":["tính năng"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"API cục bộ"},"children":["API cục bộ"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"API mở"},"children":["API mở"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Phương pháp"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Mã thông báo tĩnh (tùy chọn)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Mã thông báo truy cập OAuth2"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Tuổi thọ của mã thông báo"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Vĩnh viễn (cho đến khi được tái sinh)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["1 giờ"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Nhận ở đâu"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ThêmCài đặt ứng dụng khách Đăng nhập"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ID API trao đổi + Khóa"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Định dạng tiêu đề"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization: TOKEN"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization: Bearer TOKEN"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Bắt buộc"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Tùy chọn (có thể bị vô hiệu hóa)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Luôn được yêu cầu"]}]}]}]}]}]},"headings":[{"value":"Xác thực","id":"xác-thực","depth":1},{"value":"Xác thực API cục bộ","id":"xác-thực-api-cục-bộ","depth":2},{"value":"Chế độ mặc định (Không xác thực)","id":"chế-độ-mặc-định-không-xác-thực","depth":3},{"value":"Kích hoạt xác thực","id":"kích-hoạt-xác-thực","depth":3},{"value":"Xác thực API mở (OAuth2)","id":"xác-thực-api-mở-oauth2","depth":2},{"value":"Bước 1: Nhận ID API và khóa API","id":"bước-1-nhận-id-api-và-khóa-api","depth":3},{"value":"Bước 2: Nhận mã thông báo truy cập","id":"bước-2-nhận-mã-thông-báo-truy-cập","depth":3},{"value":"Bước 3: Sử dụng mã thông báo truy cập","id":"bước-3-sử-dụng-mã-thông-báo-truy-cập","depth":3},{"value":"So sánh xác thực","id":"so-sánh-xác-thực","depth":2}],"frontmatter":{"seo":{"title":"Xác thực"}},"lastModified":"2026-06-10T11:47:34.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/vi/api-reference/getting-started/authentication","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}