Login

POST Login (for Platform Users)

POST /services/oauth2/token

Operation ID: Login (for Platform Users). Tags: Login.

For Platform users, only an authentication call is required to retrieve the access token, which will be used for the other calls.

The Token returned in access_token must be saved and sent as a "Bearer Token" for all other calls, and must be refreshed when indicated with return of 401 for a call.

Note: If you are connected to a sandbox environment, it is necessary to change the URL prefix from login.salesforce... to test.salesforce...

Request body

Media type: application/x-www-form-urlencoded. Schema: object.

  • grant_type (string)
    Example: password.
  • client_id (string)
    Example: {{client-id}}.
  • client_secret (string)
    Example: {{client-secret}}.
  • username (string)
    Example: {{username}}.
  • password (string)
    Example: {{password}}.

Responses

  • 200 OK

    Headers:

    • Date (string)
      Example: Fri, 23 Apr 2021 15:55:00 GMT.
    • Strict-Transport-Security (string)
      Example: max-age=31536000; includeSubDomains.
    • X-Content-Type-Options (string)
      Example: nosniff.
    • X-XSS-Protection (string)
      Example: 1; mode=block.
    • Cache-Control (string)
      Example: no-cache,must-revalidate,max-age=0,no-store,private.
    • Expires (string)
      Example: Thu, 01 Jan 1970 00:00:00 GMT.
    • X-ReadOnlyMode (boolean)
      Example: false.
    • Content-Type (string)
      Example: application/json;charset=UTF-8.
    • Vary (string)
      Example: Accept-Encoding.
    • Content-Encoding (string)
      Example: gzip.
    • Transfer-Encoding (string)
      Example: chunked.

    Media type: application/json. Schema: object.

    Example

    {
      "access_token": "[example]",
      "instance_url": "https://{MyDomainName}.my.salesforce.com",
      "id": "https://login.salesforce.com/id/[example]/[example]",
      "token_type": "Bearer",
      "issued_at": "1619193301063",
      "signature": "[example]"
    }