forked from salto-io/jsforce-types
-
Notifications
You must be signed in to change notification settings - Fork 0
/
oauth2.d.ts
41 lines (37 loc) · 1.31 KB
/
oauth2.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
export interface OAuth2Options {
authzServiceUrl?: string;
tokenServiceUrl?: string;
clientId?: string;
clientSecret?: string;
httpProxy?: string;
loginUrl?: string;
proxyUrl?: string;
redirectUri?: string;
refreshToken?: string;
revokeServiceUrl?: string;
authCode?: string;
privateKeyFile?: string;
privateKey?: string; // Used for sfdx auth files for legacy support reasons
}
export interface TokenResponse {
access_token: string;
refresh_token: string;
}
export class OAuth2 {
constructor(options?: OAuth2Options);
loginUrl: string;
authzServiceUrl: string;
tokenServiceUrl: string;
revokeServiceUrl: string;
clientId: string;
clientSecret: string;
redirectUri: string;
getAuthorizationUrl(params: {
scope?: string,
state?: string
}): string;
refreshToken(code: string, callback?: (err: Error, tokenResponse: TokenResponse) => void): Promise<TokenResponse>;
requestToken(code: string, callback?: (err: Error, tokenResponse: TokenResponse) => void): Promise<TokenResponse>;
authenticate(username: string, password: string, callback?: (err: Error, tokenResponse: TokenResponse) => void): Promise<TokenResponse>;
revokeToken(accessToken: string, callback?: (err: Error, ) => void): Promise<undefined>;
}