# flytekit.clients.grpc_utils.auth_interceptor

## Directory

### Classes

| Class | Description |
|-|-|
| [`AuthUnaryInterceptor`](https://www.union.ai/docs/v1/union/api-reference/flytekit-sdk/packages/flytekit.clients.grpc_utils.auth_interceptor/page.md#flytekitclientsgrpc_utilsauth_interceptorauthunaryinterceptor) | This Interceptor can be used to automatically add Auth Metadata for every call - lazily in case authentication. |

## flytekit.clients.grpc_utils.auth_interceptor.AuthUnaryInterceptor

This Interceptor can be used to automatically add Auth Metadata for every call - lazily in case authentication
is needed.

### Parameters

```python
class AuthUnaryInterceptor(
    get_authenticator: typing.Callable[[], flytekit.clients.auth.authenticator.Authenticator],
)
```
| Parameter | Type | Description |
|-|-|-|
| `get_authenticator` | `typing.Callable[[], flytekit.clients.auth.authenticator.Authenticator]` | |

### Properties

| Property | Type | Description |
|-|-|-|
| `authenticator` | `None` |  |

### Methods

| Method | Description |
|-|-|
| [`intercept_unary_stream()`](#intercept_unary_stream) | Handles a stream call and adds authentication metadata if needed. |
| [`intercept_unary_unary()`](#intercept_unary_unary) | Intercepts unary calls and adds auth metadata if available. |

#### intercept_unary_stream()

```python
def intercept_unary_stream(
    continuation,
    client_call_details,
    request,
)
```
Handles a stream call and adds authentication metadata if needed

| Parameter | Type | Description |
|-|-|-|
| `continuation` |  | |
| `client_call_details` |  | |
| `request` |  | |

#### intercept_unary_unary()

```python
def intercept_unary_unary(
    continuation: typing.Callable,
    client_call_details: grpc.ClientCallDetails,
    request: typing.Any,
)
```
Intercepts unary calls and adds auth metadata if available. On Unauthenticated, resets the token and refreshes
and then retries with the new token

| Parameter | Type | Description |
|-|-|-|
| `continuation` | `typing.Callable` | |
| `client_call_details` | `grpc.ClientCallDetails` | |
| `request` | `typing.Any` | |

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/api-reference/flytekit-sdk/packages/flytekit.clients.grpc_utils.auth_interceptor.md
**HTML**: https://www.union.ai/docs/v1/union/api-reference/flytekit-sdk/packages/flytekit.clients.grpc_utils.auth_interceptor/
