import type { OAuthTokenType, IOAuthUtilityInteractionHandlerInfo, IOAuthToken } from '@msinternal/sp-client-shared'; import { type ServiceScope, ServiceKey } from '@microsoft/sp-core-library'; /** * This class allows one to obtain OAuth tokens * * OAuth tokens are used to authenticate the user from the sharepoint page * to other services such as PowerBI, Sway, Exchange, Yammer, etc. * * @internal @deprecated Please use AADTokenProvider instead. */ export default class DEPRECATED_DO_NOT_USE_OAuthTokenProvider { /** * The service key for OAuthTokenProvider. */ static readonly serviceKey: ServiceKey; private _tokenUtility; private _serviceScope; constructor(serviceScope: ServiceScope); /** * Fetches the oauth token for a resource if the user that's currently logged in has * access to that resource. * * The OAuth token SHOULD NOT be cached by the caller since it is already cached by the method * itself. * * If the promise returned by this method rejects, there is no point in retrying the same call. * If the response from the server signals that the request should be retried this function will do this by itself. * * An example of a resource would be https://sdfpilot.outlook.com * * @param resource - the resource for which the token should be obtained * @returns A promise that will be fulfilled with the token or that will reject * with an instance of TokenUtilityError */ getOAuthToken(resource: string, webUrl: string): Promise; /** * Fetches the oauth token for a resource if the user that's currently logged in has * access to that resource. * * The OAuth token SHOULD NOT be cached by the caller since it is already cached by the method * itself. * * If the promise returned by this method rejects, there is no point in retrying the same call. * If the response from the server signals that the request should be retried this function will do this by itself. * * An example of a resource would be https://sdfpilot.outlook.com * * @param resource - the resource for which the token should be obtained * @param webUrl - url of the token acquire request endpoint * @param tokenType - token type to issue. e.g. AAD token or STI token * @param info - info to handle interaction required errors in an oAuth request * @returns A promise that will be fulfilled with the token or that will reject * with an instance of TokenUtilityError * * @internal */ getOAuthToken(resource: string, webUrl: string, tokenType: OAuthTokenType, info?: IOAuthUtilityInteractionHandlerInfo): Promise; /** * Clears the token from a given resource from the internal cache. If there is no token * cached for the resource the method does nothing. * * @param resource - resource for which the token should be cleared from the cache */ clearCachedToken(resource: string, tokenType?: OAuthTokenType): void; /** * Returns the token utility singleton */ private _getTokenUtility; } //# sourceMappingURL=DEPRECATED_DO_NOT_USE_OAuthTokenProvider.d.ts.map