DS Server

GET /oauth/test

Endpoint

GET https://example.com/oauth/test

Description

Tests whether the access token of a request grants access to DS Server, without calling an endpoint that does any work. The endpoint was added in DS Server 3.1.0.

The token is checked the same way as on the DocumentProcessing endpoints: a token that DS Server didn't issue is passed on to the registered authentication servers. When OAuth is disabled in the admin portal (see Enable OAuth), the endpoint grants every request, with or without a token.

Examples

The following sample tests an access token passed in the authorization header.

# Request:
curl --request GET 'https://trial.dsserver.io/oauth/test' \
    --header 'Authorization: Bearer nmZ80Zn2R0P2AbS149E31IUHd5aZgB9T'

# Response:
HTTP/1.1 200 OK
Content-Length: 0

Authorization

This endpoint supports the OAuth authorization method. The access token is passed in a Bearer Authorization Header, as a Query Parameter or in a Cookie.

Authorization Header

Header fieldDescription
AuthorizationA Bearer authorization header (also called token authentication) contains the OAuth access token. The authorization method and a space i.e. "Bearer " is then put before your valid access token. For example: Authorization: Bearer 4796E23054E64BC773CACBCAF24AD179DE9A3

Query Parameter

Query parameterDescription
access_tokenThe access token is passed directly in the endpoint URL as a query string. For example: ?access_token=4796E23054E64BC773CACBCAF24AD179DE9A3

Cookie

CookieDescription
access_tokenThe access token is passed in a cookie named access_token. For example: Cookie: access_token=4796E23054E64BC773CACBCAF24AD179DE9A3

Success Response

StatusDescription
200The HTTP status code in the response header is 200 (OK), if the access token grants access. The response body is empty.

Error Response

StatusDescription
401A 401 (Unauthorized) with an empty body is returned, if OAuth is enabled and the request has no valid access token. Without a token, the response has the header WWW-Authenticate: Bearer.