@trimble-oss/trimble-id
Version:
Trimble Identity SDK for JavaScript/ TypeScript
31 lines (30 loc) • 1.76 kB
TypeScript
import { ITokenProvider } from "./ITokenProvider"
import { IEndpointProvider } from "./IEndpointProvider"
/**
* @implements {ITokenProvider}
* @description The On Behalf grant flow allows an application to act on behalf of a user. The On Behalf grant is only supported for access tokens. It does not work with any other type of token, including refresh tokens.
*/
declare class OnBehalfGrantTokenProvider implements ITokenProvider {
/**
* @description Public constructor for OnBehalfGrantTokenProvider class
* @param {IEndpointProvider} endpointProvider An endpoint provider that provides the URL for the Trimble Identity token endpoints.
* It can be be OpenIdEndpointProvider/FixedEndpointProvider
* @param {string} consumerKey The consumer key for the calling application
* @param {string} consumerSecret The consumer secret for the calling application
* @param {string} accessToken The access token that this application wishes to act on behalf of when calling another API
*/
constructor(endpointProvider: IEndpointProvider, consumerKey: string, consumerSecret: string, accessToken: string);
/**
* @description Fluent extension to add scopes
* @param {IEnumerable<string>} scopes The scopes to add to the token provider
*/
WithScopes(scopes: string[]): this;
/**
* @description Retrieves an access token for the application
* @returns {PromiseLike<string>} A Task that resolves to the value of the access token on completion
* @exception Thrown when a token endpoint is not provided by the endpoint provider
* @exception Thrown when a call to the token endpoint fails
*/
RetrieveToken(): Promise<string>;
}
export default OnBehalfGrantTokenProvider