Defjs
Core

basicAuthSSEInterceptor

SSE interceptor that sets an Authorization: Basic … header from credentials.

@defjs/core · Function

Signature

function basicAuthSSEInterceptor(
  fn: () => BasicCredential,
  options?: BasicAuthInterceptorOptions,
): SSEInterceptor;

It sets Authorization: Basic <encoded> on a copy of the request headers, replacing any existing Authorization header. Encoding and the btoa requirement are the same as for basicAuthHttpInterceptor, including the synchronous throw when btoa is missing.

Parameters

Prop

Type

fn () => BasicCredential

Factory returning username/password for each request.

options? BasicAuthInterceptorOptions

Optional custom encoder (defaults to btoa).

Returns

An SSEInterceptor that injects basic auth.

Edit this page on GitHub
Released under the MIT License. · Copyright © 2026 MunMunMiao