Skip to main content

@wildix/auth-utils > OpenIdUserProvider

OpenIdUserProvider class

The OpenIdUserProvider class is a token provider implementation that facilitates the retrieval of OpenID tokens. It interacts with a PBX server and an authentication service to securely obtain OpenID tokens.

Example Usage:

const openIdUserInput: OpenIdUserInput = {
pbxUri: "https://pbx.example.com",
user: "test@example.com",
pass: "securepassword123",
aud: "myServiceAudience",
scope: "get"
};

const environment: ServiceTokenEnv = "prod"; // Optional, could be "prod", "stage", or "stable"

const openIdProvider = new OpenIdUserProvider(openIdUserInput, environment);

try {
const idToken = await openIdProvider.token();
console.log("Received OpenID Token:", idToken);
} catch (error) {
console.error("Error fetching OpenID Token:", error.message);
}

The implementation encapsulates the logic for obtaining and caching OpenID tokens securely, abstracting away the details of the authentication process involving the PBX server and auth services. The tokens are used primarily for authenticating with services that require OpenID compliance.

Signature:

export declare class OpenIdUserProvider implements TokenProvider 

Implements: TokenProvider

Constructors

Constructor

Modifiers

Description

(constructor)(params, env)

Constructs a new instance of the OpenIdUserProvider class

Properties

Property

Modifiers

Type

Description

aud

string

auth

string

cachedToken

string | undefined

cachedTokenExpires

number | undefined

pass

string

pbxUri

string

scope

string

user

string

Methods

Method

Modifiers

Description

token()