Solicitar token de acesso
Retorne um token bearer OAuth 2.0 para uma conta de serviço da API.
Os tokens são emitidos usando a concessão de credenciais do cliente, que autentica sua conta de serviço em vez de um usuário individual.
Exchange your Base64-encoded service account credentials for an OAuth2 access token.
Enter Basic, a space, and your Base64-encoded ClientID:ClientSecret (the only value you need to edit).
Basic <Base64Encoded(ClientID:ClientSecret)>The OAuth2 grant type. Always client_credentials, because your service account authenticates as itself rather than on behalf of a user.
The scope of the access token. Always api/api.
An access token was issued.
The bearer token to send on every API request.
The type of token issued.
BearerThe lifetime of the token in seconds. Tokens are issued with a lifetime of one hour.
3600The request was rejected. invalid_client means the credentials in the Authorization header were not accepted.
POST /oauth2/token HTTP/1.1
Host: eseye-idp-prod.auth.eu-west-1.amazoncognito.com
Authorization: Basic <Base64Encoded(ClientID:ClientSecret)>
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 53
"grant_type='client_credentials'&scope='api/api'"{
"access_token": "eyJraWQiOiJhYmMxMjMiLCJhbGciOiJSUzI1NiJ9...",
"token_type": "Bearer",
"expires_in": 3600
}Retorna um token bearer OAuth 2.0 para uma conta de serviço da API.
POST /oauth2/tokenPonto de extremidade
Substitua <region> pela região da AWS fornecida pela Eseye.
Cabeçalhos da requisição
Autorização
Basic <credentials>
Sim
Content-Type
application/x-www-form-urlencoded
Sim
<credentials> é a forma codificada em Base64 de <client-id>:<client-secret>.
Parâmetros de formulário
grant_type
client_credentials
Sim
Autentica a conta de serviço.
scope
api/api
Sim
Solicita acesso à API da Eseye.
Exemplo de requisição
Resposta bem-sucedida
Uma requisição aceita retorna HTTP 200:
Reutilize o token até ele expirar e, então, solicite outro token.
Resposta de erro
O ponto de extremidade retorna HTTP 400 quando rejeita uma requisição. Um invalid_client erro significa que as credenciais não foram aceitas.
Atualizado
Isto foi útil?