Skip to main content

ApiKeyAuth

Upgather SDK


Upgather SDK / ApiKeyAuth

Class: ApiKeyAuth

Provides an API-key authentication strategy.

Remarks​

This class implements the AuthStrategy interface and applies an API key to an outgoing HTTP request via the x-api-key header. It is used for backends that authenticate with an API-Gateway-style key rather than a bearer token.

Implements​

Constructors​

new ApiKeyAuth()​

new ApiKeyAuth(apiKey): ApiKeyAuth

Creates an instance of ApiKeyAuth.

Parameters​

apiKey​

string

The API key.

Returns​

ApiKeyAuth

Methods​

authenticate()​

authenticate(request): void

Applies the API key to the HTTP request via the x-api-key header.

Parameters​

request​

HttpRequest

The HTTP request to authenticate.

Returns​

void

Implementation of​

AuthStrategy.authenticate