Credentials for the database chosen can be provided in various ways:
- Explicit logon.
- Basic authentication.
- OAuth Code Grant Flow
- Preauthenticated.
- Interactive (HTML).
- Interactive (AJAX).
## Explicit Logon Credentials
The logon code and password can be provided as HTTP GET or POST parameters named `user` and `password`.
## Basic Authentication
When present, a header named `Authorization` or `HTTP_AUTHORIZATION` is used for Basic Authentication. Logon code and password are taken from the header value following [RFC 7617](https://www.rfc-editor.org/rfc/rfc7617) for Basic Authentication.
The authentication realm with Basic Authentication matches the database name when present and `Invantive Data Access Point Default` otherwise.
When Basic Authentication and Explicit Logon Credentials are combined, the logon codes must match. Otherwise, an error is returned.
## OAuth Code Grant Flow
### Preauthenticated
The value of the `X-Refresh-Token` header is used to authenticate on the OAuth Code Grant Flow as specified for the database chosen in the [[Settings]]. When not specified as a header, the values of a GET or POST parameter with that name will be used.
### Interactive HTML
In general, it is not necessary to make changes to fit the Code Grant Flow with a normal HTML site based upon Data Access Point creating pages one-by-one. When necessary, please use the `/token` path with the `code` and `returnUrl` parameters to authenticate.
### Interactive AJAX
The `/auth` path allows AJAX calls to redirect to a log on page, returning JSON which can be evaluated from code like:
```json
{
//
// Get user information for picture and name in header.
//
var url = "auth?preset=nl-some-query"
+ "&returnUrl="
+ encodeURIComponent(window.location.href)
;
$scope.spinnerGet = $http
.get(url)
.then
( function successCallback(response)
{
var isAuthenticated = response.data.isAuthenticated;
var authenticationUrl = response.data.authenticationUrl;
if (isAuthenticated)
{
//
// Get data.
//
$scope.spinnerGet = $http
.get("Preset?preset=nl-some-query")
.then
( function successCallback(response)
{
var me = response.data.Results[0].Data[0];
var image = me.THUMBNAILPICTURE;
var imageFormat = me.THUMBNAILPICTUREFORMAT;
...
}
, function errorCallback(response)
{
alert('Could not load user information.');
}
);
}
else
{
window.location.href = authenticationUrl;
}
}
, function errorCallback(response)
{
alert('Could not load authentication information.');
}
);
}
```