Type Alias AuthModule<A>

An authentication module for a specific authentication format, like oauth, cookies etc

type AuthModule<A extends AuthType = AuthType> = {
    getRestCallAuthParams: (
        props: GetRestCallAuthParamsProps<A>,
    ) => Promise<RestCallAuthParams>;
    getWebResourceAuthParams?: (
        props: GetWebResourceAuthParamsProps<A>,
    ) => Promise<WebResourceAuthParams>;
    getWebSocketAuthParams: (
        props: GetWebSocketAuthParamsProps<A>,
    ) => Promise<WebSocketAuthParams>;
    handleAuthenticationError: (
        props: HandleAuthenticationErrorProps<A>,
    ) => Promise<AuthenticationErrorAction>;
    optionalProps?: OptionalKeys<HostConfig<A>>[];
    requiredProps?: RequiredKeys<HostConfig<A>>[];
    validateHostConfig?: (hostConfig: Record<string, unknown>) => boolean;
}

Type Parameters

Index

Properties

getRestCallAuthParams: (
    props: GetRestCallAuthParamsProps<A>,
) => Promise<RestCallAuthParams>

Get auth params for rest api calls

getWebResourceAuthParams?: (
    props: GetWebResourceAuthParamsProps<A>,
) => Promise<WebResourceAuthParams>

Get auth params for web resource request

getWebSocketAuthParams: (
    props: GetWebSocketAuthParamsProps<A>,
) => Promise<WebSocketAuthParams>

Get auth params for websocket api calls

handleAuthenticationError: (
    props: HandleAuthenticationErrorProps<A>,
) => Promise<AuthenticationErrorAction>

Callback for when auth error happens

optionalProps?: OptionalKeys<HostConfig<A>>[]

Properties that are optional for this auth module

requiredProps?: RequiredKeys<HostConfig<A>>[]

Properties required for this auth module

validateHostConfig?: (hostConfig: Record<string, unknown>) => boolean

Runtime check for validating host config