POST /oauth/token password

From Social ID Developers
Revision as of 16:56, 30 December 2021 by Gabriel.prado (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Description

Generates a new Login User Token given a combination of username/email_address and password.

Resource URL

  POST https://api.socialidnow.com/v2/marketing/oauth/token

Parameters

Form Url Encoded Parameters

grant_type required grant_type. Must be set to password.
username 1 optional username.
email_address 1 optional user e-mail.
password required user password.

1 Exactly one of these fields must be given to identify the user.

Authentication

This API requires Login App Client authentication. See Authentication.

Response

Response Status

ok (200) The access token was generated successfully
bad_request (400) Some required parameter was not informed.
unauthorized (401) The authentication is wrong. See Authentication.
internal_server_error (500) An unknown error happened.

In case of error, one of of the following codes will be set in the JSON response. An error description will also be set accordingly.

Code Description
invalid_client The request authentication is invalid (not given or combination do not match); or the client authentication is invalid.
invalid_request A required parameter was not informed (grant_type, username/email_address, password).
unsupported_grant_type The informed grant type is not supported.

Response Body

access_token The generated access token.
expires_in Expiration in seconds.
token_type The token_type. Will be set to bearer.
refresh_token The refresh_token to retrieve a new access token after expiration.

Examples

Using username and password

Request

curl -iX POST 'https://api.socialidnow.com/v2/marketing/oauth/token' \
-d grant_type=password&username=john_doe&password=john_doe_secret \
--user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf

Response

Response Headers
HTTP/1.1 200 Ok
Status: 200
Response Body
{
  "access_token": "6814cd360205e1245d2834ffab3c3c9103b71a5075a9cda4626b4d5cffbabb88",
  "expires_in": 604800,
  "token_type": "bearer",
  "refresh_token": "17ef19c3e1b7499eaf849d59f220250210b5c44c10c71033d253de8b61b2a3ef",
}

Using email_address and password

Request

curl -iX POST 'https://api.socialidnow.com/v2/marketing/oauth/token' \
-d grant_type=password&email_address=john_doe@domain.com&password=john_doe_secret \
--user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf

Response

Response Headers
HTTP/1.1 200 Ok
Status: 200
Response Body
{
  "access_token": "6814cd360205e1245d2834ffab3c3c9103b71a5075a9cda4626b4d5cffbabb88",
  "expires_in": 604800,
  "token_type": "bearer",
  "refresh_token": "17ef19c3e1b7499eaf849d59f220250210b5c44c10c71033d253de8b61b2a3ef",
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox