Skip to main content

Client Authentication Overview

Client authentication is a process allowing an authorization server identify a client and either grant them a token (which can be used to access the resource server), or prevent from getting a token.

Who Authenticates What in OAuth

There are two participants inside the client authentication flow:

  • Client is an application that requests access to protected resources from a resource server. It may be a third-party application, but it also can be an application being a part of the organization that owns the resources. In this case, this is an application that tries to authenticate.

  • Authorization server is a server that authenticates the client trying to get access to the protected resources and issues access tokens.

When Client Authentication Takes Place

Below, you can find a diagram that illustrates when the client authentication process takes place, how does it work, what happens before, and what happens next after the client is authenticated.

To know more about OAuth flows, see the OAuth Grant Types documentation.

When_Client_Authentication_Takes_Place.svg

How Authorization Server Authenticates Client Apps

  1. An OAuth client application sends a request to the authorization server's token endpoint.

    The example below provides a request example for client authentication using the client_secret_basic method and authorization_code OAuth grant flow.

    POST {tid}{aid/oauth2/token} HTTP/1.1
    User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
    Content-Type: application/json
    Authorization: Basic dl9aUnVyOWdtQ3gxTTlobGU5N2ZWQUd5amdCcUsya2hWdVlMZmZOLWVOZw==
    {
      "grant_type" : "authorization_code"
      "code" : "xxxxxxxxxxx"
    }
  2. The authorization server validates the request.

    • It checks for all required parameters depending on the client authentication method chosen and grant type chosen.

  3. The authorization server generates the requested tokens (access/refresh/ID) and provides them to the client.

    See the following response example:

    HTTP/1.1 200 OK
     Content-Type: application/json;charset=UTF-8
     Cache-Control: no-store
     Pragma: no-cache
    
    {
       "access_token":"2YotnFZFEjr1zCsicMWpAA",
       "token_type":"example",
       "expires_in":3600,
       "refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA",
       "scope":"openid profile"
    }

    Result: The client is authenticated. The application is now able to request data from the resource server (your API).

Client Authentication Methods

Depending on the authorization server configuration, client applications can use one of the following authentication methods: