UNPKG

1.78 kBTypeScriptView Raw
1import * as stream from 'stream';
2import { JWTInput } from './credentials';
3import { GetTokenResponse, OAuth2Client, OAuth2ClientOptions } from './oauth2client';
4export declare const USER_REFRESH_ACCOUNT_TYPE = "authorized_user";
5export interface UserRefreshClientOptions extends OAuth2ClientOptions {
6 clientId?: string;
7 clientSecret?: string;
8 refreshToken?: string;
9}
10export declare class UserRefreshClient extends OAuth2Client {
11 _refreshToken?: string | null;
12 /**
13 * User Refresh Token credentials.
14 *
15 * @param clientId The authentication client ID.
16 * @param clientSecret The authentication client secret.
17 * @param refreshToken The authentication refresh token.
18 */
19 constructor(clientId?: string, clientSecret?: string, refreshToken?: string);
20 constructor(options: UserRefreshClientOptions);
21 constructor(clientId?: string, clientSecret?: string, refreshToken?: string);
22 /**
23 * Refreshes the access token.
24 * @param refreshToken An ignored refreshToken..
25 * @param callback Optional callback.
26 */
27 protected refreshTokenNoCache(refreshToken?: string | null): Promise<GetTokenResponse>;
28 fetchIdToken(targetAudience: string): Promise<string>;
29 /**
30 * Create a UserRefreshClient credentials instance using the given input
31 * options.
32 * @param json The input object.
33 */
34 fromJSON(json: JWTInput): void;
35 /**
36 * Create a UserRefreshClient credentials instance using the given input
37 * stream.
38 * @param inputStream The input stream.
39 * @param callback Optional callback.
40 */
41 fromStream(inputStream: stream.Readable): Promise<void>;
42 fromStream(inputStream: stream.Readable, callback: (err?: Error) => void): void;
43 private fromStreamAsync;
44}