> Documentation index: https://www.gooddata.ai/docs/gooddata-ui/llms.txt lists every page of these docs as Markdown.

# ContextDeferredAuthProvider

- Package: [@gooddata/sdk-backend-tiger](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-tiger/index.md)
- Kind: class
- Source: https://github.com/gooddata/gooddata-ui-sdk/blob/rel/11.64/libs/sdk-backend-tiger/src/auth.ts
- Guides: [Renew the session without a redirect](https://www.gooddata.ai/docs/gooddata-ui/latest/integrations/renew-session-silently/index.md)

This implementation of authentication provider defers the responsibility for performing authentication to the context in which it exists.

**Signature:**

```typescript
export declare class ContextDeferredAuthProvider extends TigerAuthProviderBase 
```
**Extends:** [TigerAuthProviderBase](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-tiger/sdk-backend-tiger.tigerauthproviderbase/index.md)

## Remarks

In other words it expects that the application will take care of driving the authentication and creating a correct session in which the Tiger backend can make authenticated calls.

This is a go-to authentication provider for UI applications. The entire flow is as follows:

- The application that uses backend configured with this provider must expect that some of the backend  calls with result in NotAuthenticated exception.

- The exception will contain `loginUrl` set to the URL on the current origin - this is location of the login page.

- The application must redirect the entire window to this URL appended with `redirectTo` query parameter.

- The value of this parameter is the application's URL that will be used as a return location.

- The login page will start and drive the OIDC authentication flow. Once the flow finishes and session  is set up, the login page will redirect back to the application.

You may use the provider's ability to use passed `NotAuthenticatedHandler` function. This will be called every time a NotAuthenticated error is raised by the backend. Your application can pass a custom handler of this event - typically something that will start driving the authentication from a single place.

Note: the not authenticated handler MAY be called many times in succession so you may want to wrap it in a call guard or in a debounce.

See [redirectToTigerAuthentication()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-tiger/sdk-backend-tiger.redirecttotigerauthentication/index.md) for implementation of the NotAuthenticated handler which you may use with this provider.

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [onNotAuthenticated](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-tiger/sdk-backend-tiger.contextdeferredauthprovider/index.md#contextdeferredauthprovideronnotauthenticated) |  | (context: [IAuthenticationContext](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iauthenticationcontext/index.md), error: [NotAuthenticated](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.notauthenticated/index.md)) =&gt; void |  |

## Methods

| Method | Modifiers | Description |
| --- | --- | --- |
| [authenticate(context)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-tiger/sdk-backend-tiger.contextdeferredauthprovider/index.md#contextdeferredauthproviderauthenticate) |  |  |

## Property details

### ContextDeferredAuthProvider.onNotAuthenticated

**Signature:**

```typescript
onNotAuthenticated: (context: IAuthenticationContext, error: NotAuthenticated) => void;
```

## Method details

### ContextDeferredAuthProvider.authenticate()

**Signature:**

```typescript
authenticate(context: IAuthenticationContext): Promise<IAuthenticatedPrincipal>;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| context | [IAuthenticationContext](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iauthenticationcontext/index.md) |  |

**Returns:**

Promise&lt;[IAuthenticatedPrincipal](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iauthenticatedprincipal/index.md)&gt;
