# SyncGateway.AuthApi

All URIs are relative to *http://localhost:4984/*

Method | HTTP request | Description
------------- | ------------- | -------------
[**dbOidcCallbackGet**](AuthApi.md#dbOidcCallbackGet) | **GET** /{db}/_oidc_callback | OpenID Connect Authentication callback.
[**dbOidcChallengeGet**](AuthApi.md#dbOidcChallengeGet) | **GET** /{db}/_oidc_challenge | OpenID Connect Authentication.
[**dbOidcGet**](AuthApi.md#dbOidcGet) | **GET** /{db}/_oidc | OpenID Connect Authentication.
[**dbOidcRefreshGet**](AuthApi.md#dbOidcRefreshGet) | **GET** /{db}/_oidc_refresh | OpenID Connect refresh.


<a name="dbOidcCallbackGet"></a>
# **dbOidcCallbackGet**
> InlineResponse2001 dbOidcCallbackGet(dbcode, opts)

OpenID Connect Authentication callback.

Sync Gateway callback URL that clients are redirected to by the OpenID Connect provider.  

### Example
```javascript
var SyncGateway = require('sync_gateway');
var defaultClient = SyncGateway.ApiClient.default;

// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

var apiInstance = new SyncGateway.AuthApi();

var db = "db_example"; // String | Database name

var code = "code_example"; // String | OpenID Connect Authorization code.

var opts = { 
  'provider': "provider_example" // String | OpenId Connect provider to be used for authentication, from the list of providers defined in the Sync Gateway Config. If not specified, will attempt to authenticate using the default provider.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.dbOidcCallbackGet(dbcode, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **db** | **String**| Database name | 
 **code** | **String**| OpenID Connect Authorization code. | 
 **provider** | **String**| OpenId Connect provider to be used for authentication, from the list of providers defined in the Sync Gateway Config. If not specified, will attempt to authenticate using the default provider. | [optional] 

### Return type

[**InlineResponse2001**](InlineResponse2001.md)

### Authorization

[apiKey](../README.md#apiKey)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="dbOidcChallengeGet"></a>
# **dbOidcChallengeGet**
> dbOidcChallengeGet(db, opts)

OpenID Connect Authentication.

Called by clients to initiate the OIDC Authorization Code flow.  

### Example
```javascript
var SyncGateway = require('sync_gateway');
var defaultClient = SyncGateway.ApiClient.default;

// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

var apiInstance = new SyncGateway.AuthApi();

var db = "db_example"; // String | Database name

var opts = { 
  'offline': true, // Boolean | When true, requests a refresh token from the OP. Sets access_type=offline and prompt=consent on the redirect to the OP. Secure clients should set offline=true and persist the returned refresh token to secure storage.
  'provider': "provider_example" // String | OpenId Connect provider to be used for authentication, from the list of providers defined in the Sync Gateway Config. If not specified, will attempt to authenticate using the default provider.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.dbOidcChallengeGet(db, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **db** | **String**| Database name | 
 **offline** | **Boolean**| When true, requests a refresh token from the OP. Sets access_type&#x3D;offline and prompt&#x3D;consent on the redirect to the OP. Secure clients should set offline&#x3D;true and persist the returned refresh token to secure storage. | [optional] 
 **provider** | **String**| OpenId Connect provider to be used for authentication, from the list of providers defined in the Sync Gateway Config. If not specified, will attempt to authenticate using the default provider. | [optional] 

### Return type

null (empty response body)

### Authorization

[apiKey](../README.md#apiKey)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="dbOidcGet"></a>
# **dbOidcGet**
> dbOidcGet(db, opts)

OpenID Connect Authentication.

Called by clients to initiate the OIDC Authorization Code flow.  

### Example
```javascript
var SyncGateway = require('sync_gateway');
var defaultClient = SyncGateway.ApiClient.default;

// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

var apiInstance = new SyncGateway.AuthApi();

var db = "db_example"; // String | Database name

var opts = { 
  'offline': true, // Boolean | When true, requests a refresh token from the OP. Sets access_type=offline and prompt=consent on the redirect to the OP. Secure clients should set offline=true and persist the returned refresh token to secure storage.
  'provider': "provider_example" // String | OpenId Connect provider to be used for authentication, from the list of providers defined in the Sync Gateway Config. If not specified, will attempt to authenticate using the default provider.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.dbOidcGet(db, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **db** | **String**| Database name | 
 **offline** | **Boolean**| When true, requests a refresh token from the OP. Sets access_type&#x3D;offline and prompt&#x3D;consent on the redirect to the OP. Secure clients should set offline&#x3D;true and persist the returned refresh token to secure storage. | [optional] 
 **provider** | **String**| OpenId Connect provider to be used for authentication, from the list of providers defined in the Sync Gateway Config. If not specified, will attempt to authenticate using the default provider. | [optional] 

### Return type

null (empty response body)

### Authorization

[apiKey](../README.md#apiKey)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="dbOidcRefreshGet"></a>
# **dbOidcRefreshGet**
> InlineResponse2002 dbOidcRefreshGet(dbrefreshToken, opts)

OpenID Connect refresh.

Used to obtain a new OpenID Connect ID token based on the provided refresh token. 

### Example
```javascript
var SyncGateway = require('sync_gateway');
var defaultClient = SyncGateway.ApiClient.default;

// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

var apiInstance = new SyncGateway.AuthApi();

var db = "db_example"; // String | Database name

var refreshToken = "refreshToken_example"; // String | OpenID Connect refresh token.

var opts = { 
  'provider': "provider_example" // String | OpenId Connect provider to be used for authentication, from the list of providers defined in the Sync Gateway Config. If not specified, will attempt to authenticate using the default provider.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.dbOidcRefreshGet(dbrefreshToken, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **db** | **String**| Database name | 
 **refreshToken** | **String**| OpenID Connect refresh token. | 
 **provider** | **String**| OpenId Connect provider to be used for authentication, from the list of providers defined in the Sync Gateway Config. If not specified, will attempt to authenticate using the default provider. | [optional] 

### Return type

[**InlineResponse2002**](InlineResponse2002.md)

### Authorization

[apiKey](../README.md#apiKey)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

