-
Notifications
You must be signed in to change notification settings - Fork 184
Expand file tree
/
Copy pathdefinitions.ts
More file actions
108 lines (91 loc) · 2.38 KB
/
Copy pathdefinitions.ts
File metadata and controls
108 lines (91 loc) · 2.38 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/// <reference types="@capacitor/cli" />
declare module '@capacitor/cli' {
export interface PluginsConfig {
GoogleAuth: GoogleAuthPluginOptions;
}
}
export interface User {
id: string;
email: string;
name: string;
familyName: string;
givenName: string;
imageUrl: string;
serverAuthCode: string;
authentication: Authentication;
}
export interface Authentication {
accessToken: string;
idToken: string;
/**
* refreshToken only for iOS and Android
*/
refreshToken?: string;
}
export interface GoogleAuthPluginOptions {
/**
* The app's client ID, found and created in the Google Developers Console.
* common for Android or iOS
* @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com
* @since 3.1.0
*/
clientId?: string;
/**
* Specific client ID key for iOS
* @since 3.1.0
*/
iosClientId?: string;
/**
* Specific client ID key for Android
* @since 3.1.0
*/
androidClientId?: string;
/**
* Scopes that you might need to request to access Google APIs
* @example ["profile", "email"]
* @default []
* @see @link https://developers.google.com/identity/protocols/oauth2/scopes
*/
scopes?: string[];
/**
* This is used for offline access and server side handling
* @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com
* @default false
*/
serverClientId?: string;
/**
* Force user to select email address to regenerate AuthCode used to get a valid refreshtoken (work on iOS and Android)
* @default false
*/
forceCodeForRefreshToken?: boolean;
}
export interface InitOptions extends Pick<GoogleAuthPluginOptions, 'scopes' | 'clientId'> {
/**
* Set if your application needs to refresh access tokens when the user is not present at the browser.
* In response use `serverAuthCode` key
*
* @default false
* @since 3.1.0
* */
grantOfflineAccess: boolean;
}
export interface GoogleAuthPlugin {
signIn(): Promise<User>;
refresh(): Promise<Authentication>;
signOut(): Promise<any>;
/**
* Init hook for load gapi and init plugin
* @since 3.1.0
* */
initialize(options?: Partial<InitOptions>): void;
/**
* Add additional scopes request for user
* @since 3.2.0
* */
addScopes(scopes: string[]): Promise<void>;
/**
* Remove additional scopes request for user
* @since 3.2.0
* */
removeScopes(scopes: string[]): Promise<void>;
}