Skip to navigation

Authenticate user and get access token

View as Markdown

Authenticates a user with username/password and returns a token for use in subsequent API calls. Also sets a session cookie.

The returned access token should be included in the Authorization header for subsequent requests in the format: Authorization: Bearer {token}.

Request

This endpoint expects an object.
usernamestringRequired
User's login name
passwordstringRequiredformat: "password"
User's password
databasestringOptional

Target database name (defaults to system if not specified)

Response

Successfully authenticated
access_tokenstring

Access token for subsequent API calls. This token should be included in the Authorization header for all authenticated requests using the format: Authorization: Bearer {token}.

statusobjectRead-only
Status information about the login operation. A successful login will have a SQL state of "00000".
usernamestringOptional
The authenticated user's username. This is useful for displaying in UIs or for audit logging purposes.
databasestringOptional
The database that was authenticated against. This is the default database for subsequent queries if none is specified.
expires_inintegerOptional
Number of seconds until the access token expires. Clients should refresh the token before this time to maintain uninterrupted access.

Errors

401
Unauthorized Error
404
Not Found Error
500
Internal Server Error