node-cli-authorization

Version: 2.0.4
Release Notes
| Change Log

Provides auth functionality for node command-line applications.

Usage:

@itwin/node-cli-authorization* package contains a Node.js command-line based client for authorization with the iTwin Platform by default and is configurable to work with any OAuth2.0 based provider.

const authClient = new NodeCliAuthorizationClient({
// The OAuth token issuer URL. Defaults to Bentley's auth URL if undefined.
readonly issuerUrl?: string;

// Upon signing in, the client application receives a response from the Bentley IMS OIDC/OAuth2 provider at this URI
// For this client, must start with `http://localhost:${redirectPort}`
// Defaults to "http://localhost:3000/signin-callback" if undefined.

readonly redirectUri?: string;

// Client application's identifier as registered with the OIDC/OAuth2 provider.
readonly clientId: string;

// List of space separated scopes to request access to various resources.
readonly scope: string;

// Time in seconds that's used as a buffer to check the token for validity/expiry.
// The checks for authorization, and refreshing access tokens all use this buffer - i.e., the token is considered expired if the current time is within the specified
// time of the actual expiry.
// @note If unspecified this defaults to 10 minutes.

readonly expiryBuffer ?: number;
});

// start the authorization processs:
await authClient.signIn();

## Topics

| Name | Description |
|-----|-----|
| [Authorization](authorization) | Classes for signing a user in and out from the command line. |
| [All](all) | Displays the contents of all topics in this package. |

Last Updated: 29 April, 2025