{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/pt/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["img"]},"type":"markdown"},"seo":{"title":"Autenticação","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":"autenticação","__idx":0},"children":["Autenticação"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["MoreLogin usa diferentes métodos de autenticação para seus dois tipos de API."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"autenticação-de-api-local","__idx":1},"children":["Autenticação de API local"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A API local é executada em ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http://127.0.0.1:40000"]}," e só pode ser acessada na máquina local."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"modo-padrão-sem-autenticação","__idx":2},"children":["Modo padrão (sem autenticação)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Por padrão, a API Local não requer autenticação. Você pode fazer solicitações diretamente:"]},{"$$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":"habilitando-autenticação","__idx":3},"children":["Habilitando Autenticação"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Para maior segurança, você pode habilitar a autenticação de API local no cliente MoreLogin:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Abra o cliente MoreLogin"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Navegue até ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Configurações"]}," → ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["API e MCP"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Ativar ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Autenticação de API Local"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Copie o token de autorização gerado"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image.590455fe8c04c7aec45454ddba2524af46ee8128e15fbef43221c071f4863f91.c99b4305.png","alt":"Ativar autenticação de API local"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Após habilitar, inclua o cabeçalho ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization"]}," em todas as solicitações:"]},{"$$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":["Observação de segurança"]},": a API local está disponível apenas em ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["localhost"]},". Não pode ser acessado remotamente."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"autenticação-de-api-aberta-oauth2","__idx":4},"children":["Autenticação de API aberta (OAuth2)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A Open API usa o fluxo de credenciais do cliente OAuth2 para autenticar solicitações."]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Endpoint do servidor API aberto: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.morelogin.com"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"etapa-1-obtenha-o-id-da-api-e-a-chave-da-api","__idx":5},"children":["Etapa 1: Obtenha o ID da API e a chave da API"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Abra o cliente MoreLogin"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Navegue até ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Configurações"]}," → ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["API e MCP"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Copie o ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["ID da API"]}," e a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Chave da API"]}]}]},{"$$mdtype":"Tag","name":"Image","attributes":{"src":"/assets/image.5fd3488a120b7d8e2f400229cb0ad75e34ad8299fa6cfc9c304c29662ff9ade1.7428c38b.png","alt":"ID e chave da API","framed":false,"withLightbox":true,"width":"","height":""},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"etapa-2-obtenha-o-token-de-acesso","__idx":6},"children":["Etapa 2: Obtenha o token de acesso"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Troque seu ID de API e sua chave de API por um token de acesso:"]},{"$$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":["Exemplo de resposta:"]}]},{"$$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":"etapa-3-usar-token-de-acesso","__idx":7},"children":["Etapa 3: usar token de acesso"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Inclua o token de acesso no cabeçalho ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization"]}," para todas as solicitações da Open API:"]},{"$$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":["Observação"]},": os tokens de acesso expiram após ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["3.600 segundos"]}," (1 hora). Solicite um novo token quando o atual expirar."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"comparação-de-autenticação","__idx":8},"children":["Comparação de autenticação"]},{"$$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":"Recurso"},"children":["Recurso"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"API local"},"children":["API local"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"API aberta"},"children":["API aberta"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Método"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Token estático (opcional)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Token de acesso OAuth2"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Vida útil do token"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Permanente (até regenerado)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["1 hora"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Onde conseguir"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["MaisConfigurações do cliente Login"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ID + chave da API do Exchange"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Formato do cabeçalho"]}]},{"$$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":["Obrigatório"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Opcional (pode ser desativado)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Sempre obrigatório"]}]}]}]}]}]},"headings":[{"value":"Autenticação","id":"autenticação","depth":1},{"value":"Autenticação de API local","id":"autenticação-de-api-local","depth":2},{"value":"Modo padrão (sem autenticação)","id":"modo-padrão-sem-autenticação","depth":3},{"value":"Habilitando Autenticação","id":"habilitando-autenticação","depth":3},{"value":"Autenticação de API aberta (OAuth2)","id":"autenticação-de-api-aberta-oauth2","depth":2},{"value":"Etapa 1: Obtenha o ID da API e a chave da API","id":"etapa-1-obtenha-o-id-da-api-e-a-chave-da-api","depth":3},{"value":"Etapa 2: Obtenha o token de acesso","id":"etapa-2-obtenha-o-token-de-acesso","depth":3},{"value":"Etapa 3: usar token de acesso","id":"etapa-3-usar-token-de-acesso","depth":3},{"value":"Comparação de autenticação","id":"comparação-de-autenticação","depth":2}],"frontmatter":{"seo":{"title":"Autenticação"}},"lastModified":"2026-06-10T11:47:34.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/pt/api-reference/getting-started/authentication","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}