-
Notifications
You must be signed in to change notification settings - Fork 208
/
AuthorizationClient.ts
23 lines (21 loc) · 1.59 KB
/
AuthorizationClient.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module Authorization
*/
import { AccessToken } from "@itwin/core-bentley";
/** Provides authorization to access APIs.
* Bentley's iTwin platform APIs [use OAuth 2.0](https://developer.bentley.com/apis/overview/authorization/) for authorization.
* Implementations are provided for [Electron](https://www.npmjs.com/package/@itwin/electron-authorization), [browsers](https://www.npmjs.com/package/@itwin/browser-authorization),
* [services](https://www.npmjs.com/package/@itwin/service-authorization), and [command-line applications](https://www.npmjs.com/package/@itwin/node-cli-authorization).
* @see [IModelHostOptions.authorizationClient]($backend) and [IModelAppOptions.authorizationClient]($frontend) to configure the client.
* @see [IModelHost.authorizationClient]($backend) and [IModelApp.authorizationClient]($frontend) to access the configured client.
* @note Access tokens expire periodically and are automatically refreshed when possible; therefore, tokens should always be requested via the client, not cached for later reuse.
@public
*/
export interface AuthorizationClient {
/** Obtain an [[AccessToken]] for the currently authorized user, or blank string if no token is available. */
getAccessToken(): Promise<AccessToken>;
}