cordova-plugin-firebase-authentication 5.0.0 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +537 -127
- package/package.json +15 -6
- package/plugin.xml +10 -9
- package/src/android/FirebaseAuthenticationPlugin.java +82 -95
- package/src/ios/FirebaseAuthenticationPlugin.h +1 -1
- package/src/ios/FirebaseAuthenticationPlugin.m +2 -0
- package/tsconfig.json +15 -0
- package/types/FirebaseAuthentication.d.ts +258 -0
- package/types/index.d.ts +7 -0
- package/www/FirebaseAuthentication.js +372 -106
|
@@ -1,109 +1,375 @@
|
|
|
1
|
-
var exec = require("cordova/exec");
|
|
2
1
|
var PLUGIN_NAME = "FirebaseAuthentication";
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
var exec = require("cordova/exec");
|
|
4
|
+
|
|
5
|
+
exports.onAuthStateChanged =
|
|
6
|
+
/**
|
|
7
|
+
* Registers a block as an auth state did change listener. To be invoked when:
|
|
8
|
+
* - The block is registered as a listener,
|
|
9
|
+
* - A user with a different UID from the current user has signed in, or
|
|
10
|
+
* - The current user has signed out.
|
|
11
|
+
* @param {(userDetails: UserDetails | null) => void} callback Callback function
|
|
12
|
+
* @param {(error: string) => void} [errorCallback] Error callback function
|
|
13
|
+
*/
|
|
14
|
+
function(callback, errorCallback) {
|
|
15
|
+
exec(callback, errorCallback, PLUGIN_NAME, "setAuthStateChanged", [false]);
|
|
16
|
+
|
|
17
|
+
return function() {
|
|
18
|
+
exec(null, errorCallback, PLUGIN_NAME, "setAuthStateChanged", [true]);
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.getCurrentUser =
|
|
23
|
+
/**
|
|
24
|
+
* Returns the current user in the Firebase instance.
|
|
25
|
+
* @returns {Promise<UserDetails>} Fulfills promise with user details
|
|
26
|
+
*/
|
|
27
|
+
function() {
|
|
28
|
+
return new Promise(function (resolve, reject) {
|
|
29
|
+
exec(resolve, reject, PLUGIN_NAME, "getCurrentUser", []);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.getIdToken =
|
|
34
|
+
/**
|
|
35
|
+
* Returns a JWT token used to identify the user to a Firebase service.
|
|
36
|
+
* @param {boolean} forceRefresh When <code>true</code> cached value is ignored
|
|
37
|
+
* @returns {Promise<string>} Fulfills promis with id token string value
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* cordova.plugins.firebase.auth.getIdToken().then(function(idToken) {
|
|
41
|
+
* // send token to server
|
|
42
|
+
* });
|
|
43
|
+
*/
|
|
44
|
+
function(forceRefresh) {
|
|
45
|
+
return new Promise(function(resolve, reject) {
|
|
46
|
+
if (forceRefresh == null) forceRefresh = false;
|
|
47
|
+
|
|
48
|
+
exec(resolve, reject, PLUGIN_NAME, "getIdToken", [forceRefresh]);
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
exports.createUserWithEmailAndPassword =
|
|
53
|
+
/**
|
|
54
|
+
* Creates a new user account with the given email address and password.
|
|
55
|
+
* @param {string} email User account email
|
|
56
|
+
* @param {string} password User accound password
|
|
57
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* cordova.plugins.firebase.auth.createUserWithEmailAndPassword("my@mail.com", "pa55w0rd");
|
|
61
|
+
*/
|
|
62
|
+
function(email, password) {
|
|
63
|
+
return new Promise(function(resolve, reject) {
|
|
64
|
+
exec(resolve, reject, PLUGIN_NAME, "createUserWithEmailAndPassword", [email, password]);
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
exports.sendEmailVerification =
|
|
69
|
+
/**
|
|
70
|
+
* Initiates email verification for the current user.
|
|
71
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* cordova.plugins.firebase.auth.sendEmailVerification();
|
|
75
|
+
*/
|
|
76
|
+
function() {
|
|
77
|
+
return new Promise(function(resolve, reject) {
|
|
78
|
+
exec(resolve, reject, PLUGIN_NAME, "sendEmailVerification", []);
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
exports.sendPasswordResetEmail =
|
|
83
|
+
/**
|
|
84
|
+
* Triggers the Firebase Authentication backend to send a password-reset email
|
|
85
|
+
* to the given email address, which must correspond to an existing user of your app.
|
|
86
|
+
* @param {string} email User account email
|
|
87
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* cordova.plugins.firebase.auth.sendPasswordResetEmail("my@mail.com");
|
|
91
|
+
*/
|
|
92
|
+
function(email) {
|
|
93
|
+
return new Promise(function(resolve, reject) {
|
|
94
|
+
exec(resolve, reject, PLUGIN_NAME, "sendPasswordResetEmail", [email]);
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.signInWithEmailAndPassword =
|
|
99
|
+
/**
|
|
100
|
+
* Triggers the Firebase Authentication backend to send a password-reset email
|
|
101
|
+
* to the given email address, which must correspond to an existing user of your app.
|
|
102
|
+
* @param {string} email User account email
|
|
103
|
+
* @param {string} password User accound password
|
|
104
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* cordova.plugins.firebase.auth.signInWithEmailAndPassword("my@mail.com", "pa55w0rd");
|
|
108
|
+
*/
|
|
109
|
+
function(email, password) {
|
|
110
|
+
return new Promise(function(resolve, reject) {
|
|
111
|
+
exec(resolve, reject, PLUGIN_NAME, "signInWithEmailAndPassword", [email, password]);
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
exports.signInAnonymously =
|
|
116
|
+
/**
|
|
117
|
+
* Create and use temporary anonymous account to authenticate with Firebase.
|
|
118
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* cordova.plugins.firebase.auth.signInAnonymously();
|
|
122
|
+
*/
|
|
123
|
+
function() {
|
|
124
|
+
return new Promise(function(resolve, reject) {
|
|
125
|
+
exec(resolve, reject, PLUGIN_NAME, "signInAnonymously", []);
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
exports.signInWithGoogle =
|
|
130
|
+
/**
|
|
131
|
+
* Uses Google's <code>idToken</code> and <code>accessToken</code> to sign-in into firebase account.
|
|
132
|
+
* @param {string} idToken Google ID token
|
|
133
|
+
* @param {string} accessToken Google Access token
|
|
134
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
135
|
+
*
|
|
136
|
+
* @see https://firebase.google.com/docs/auth/android/google-signin
|
|
137
|
+
* @see https://firebase.google.com/docs/auth/ios/google-signin
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* // Below we use cordova-plugin-googleplus to trigger Google Login UI
|
|
141
|
+
* window.plugins.googleplus.login({
|
|
142
|
+
* scopes: '... ',
|
|
143
|
+
* webClientId: '1234...',
|
|
144
|
+
* offline: true
|
|
145
|
+
* }, function(res) {
|
|
146
|
+
* cordova.plugins.firebase.auth.signInWithGoogle(res.idToken, res.accessToken).then(function() {
|
|
147
|
+
* console.log("Firebase logged in with Google");
|
|
148
|
+
* }, function(err) {
|
|
149
|
+
* console.error("Firebase login failed", err);
|
|
150
|
+
* });
|
|
151
|
+
* }, function(err) {
|
|
152
|
+
* console.error("Google login failed", err);
|
|
153
|
+
* });
|
|
154
|
+
*/
|
|
155
|
+
function(idToken, accessToken) {
|
|
156
|
+
return new Promise(function(resolve, reject) {
|
|
157
|
+
exec(resolve, reject, PLUGIN_NAME, "signInWithGoogle", [idToken, accessToken]);
|
|
158
|
+
});
|
|
159
|
+
};
|
|
3
160
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return new Promise(function(resolve, reject) {
|
|
19
|
-
if (forceRefresh == null) forceRefresh = false;
|
|
20
|
-
|
|
21
|
-
exec(resolve, reject, PLUGIN_NAME, "getIdToken", [forceRefresh]);
|
|
22
|
-
});
|
|
23
|
-
},
|
|
24
|
-
createUserWithEmailAndPassword: function(email, password) {
|
|
25
|
-
return new Promise(function(resolve, reject) {
|
|
26
|
-
exec(resolve, reject, PLUGIN_NAME, "createUserWithEmailAndPassword", [email, password]);
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
sendEmailVerification: function() {
|
|
30
|
-
return new Promise(function(resolve, reject) {
|
|
31
|
-
exec(resolve, reject, PLUGIN_NAME, "sendEmailVerification", []);
|
|
32
|
-
});
|
|
33
|
-
},
|
|
34
|
-
sendPasswordResetEmail: function(email) {
|
|
35
|
-
return new Promise(function(resolve, reject) {
|
|
36
|
-
exec(resolve, reject, PLUGIN_NAME, "sendPasswordResetEmail", [email]);
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
signInWithEmailAndPassword: function(email, password) {
|
|
40
|
-
return new Promise(function(resolve, reject) {
|
|
41
|
-
exec(resolve, reject, PLUGIN_NAME, "signInWithEmailAndPassword", [email, password]);
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
signInAnonymously: function(email, password) {
|
|
45
|
-
return new Promise(function(resolve, reject) {
|
|
46
|
-
exec(resolve, reject, PLUGIN_NAME, "signInAnonymously", []);
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
signInWithGoogle: function(idToken, accessToken) {
|
|
50
|
-
return new Promise(function(resolve, reject) {
|
|
51
|
-
exec(resolve, reject, PLUGIN_NAME, "signInWithGoogle", [idToken, accessToken]);
|
|
52
|
-
});
|
|
53
|
-
},
|
|
54
|
-
signInWithFacebook: function(accessToken) {
|
|
55
|
-
return new Promise(function(resolve, reject) {
|
|
56
|
-
exec(resolve, reject, PLUGIN_NAME, "signInWithFacebook", [accessToken]);
|
|
57
|
-
});
|
|
58
|
-
},
|
|
59
|
-
signInWithTwitter: function(token, secret) {
|
|
60
|
-
return new Promise(function(resolve, reject) {
|
|
61
|
-
exec(resolve, reject, PLUGIN_NAME, "signInWithTwitter", [token, secret]);
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
signInWithApple: function(idToken, rawNonce) {
|
|
65
|
-
return new Promise(function(resolve, reject) {
|
|
66
|
-
exec(resolve, reject, PLUGIN_NAME, "signInWithApple", [idToken, rawNonce || null]);
|
|
67
|
-
});
|
|
68
|
-
},
|
|
69
|
-
verifyPhoneNumber: function(phoneNumber, timeoutMillis) {
|
|
70
|
-
return new Promise(function(resolve, reject) {
|
|
71
|
-
exec(resolve, reject, PLUGIN_NAME, "verifyPhoneNumber", [phoneNumber, timeoutMillis]);
|
|
72
|
-
});
|
|
73
|
-
},
|
|
74
|
-
signInWithVerificationId: function(verificationId, code) {
|
|
75
|
-
return new Promise(function(resolve, reject) {
|
|
76
|
-
exec(resolve, reject, PLUGIN_NAME, "signInWithVerificationId", [verificationId, code]);
|
|
77
|
-
});
|
|
78
|
-
},
|
|
79
|
-
signInWithCustomToken: function (idToken) {
|
|
80
|
-
return new Promise(function (resolve, reject) {
|
|
81
|
-
exec(resolve, reject, PLUGIN_NAME, "signInWithCustomToken", [idToken]);
|
|
82
|
-
})
|
|
83
|
-
},
|
|
84
|
-
signOut: function() {
|
|
85
|
-
return new Promise(function(resolve, reject) {
|
|
86
|
-
exec(resolve, reject, PLUGIN_NAME, "signOut", []);
|
|
87
|
-
});
|
|
88
|
-
},
|
|
89
|
-
setLanguageCode: function(languageCode) {
|
|
90
|
-
return new Promise(function(resolve, reject) {
|
|
91
|
-
exec(resolve, reject, PLUGIN_NAME, "setLanguageCode", [languageCode]);
|
|
92
|
-
});
|
|
93
|
-
},
|
|
94
|
-
useAppLanguage: function() {
|
|
95
|
-
return new Promise(function(resolve, reject) {
|
|
96
|
-
exec(resolve, reject, PLUGIN_NAME, "setLanguageCode", [null]);
|
|
97
|
-
});
|
|
98
|
-
},
|
|
99
|
-
updateProfile: function(profile) {
|
|
100
|
-
return new Promise(function(resolve, reject) {
|
|
101
|
-
exec(resolve, reject, PLUGIN_NAME, "updateProfile", [profile || {}]);
|
|
102
|
-
});
|
|
103
|
-
},
|
|
104
|
-
useEmulator: function(host, port) {
|
|
105
|
-
return new Promise(function(resolve, reject) {
|
|
106
|
-
exec(resolve, reject, PLUGIN_NAME, "useEmulator", [host, port]);
|
|
107
|
-
});
|
|
108
|
-
}
|
|
161
|
+
exports.signInWithFacebook =
|
|
162
|
+
/**
|
|
163
|
+
* Uses Facebook's <code>accessToken</code> to sign-in into firebase account. In order to
|
|
164
|
+
* retrieve those tokens follow instructions for iOS and Android from Firebase docs.
|
|
165
|
+
* @param {string} accessToken Facebook's access token string
|
|
166
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
167
|
+
*
|
|
168
|
+
* @see https://firebase.google.com/docs/auth/android/facebook-login
|
|
169
|
+
* @see https://firebase.google.com/docs/auth/ios/facebook-login
|
|
170
|
+
*/
|
|
171
|
+
function(accessToken) {
|
|
172
|
+
return new Promise(function(resolve, reject) {
|
|
173
|
+
exec(resolve, reject, PLUGIN_NAME, "signInWithFacebook", [accessToken]);
|
|
174
|
+
});
|
|
109
175
|
};
|
|
176
|
+
|
|
177
|
+
exports.signInWithTwitter =
|
|
178
|
+
/**
|
|
179
|
+
* Uses Twitter's <code>token</code> and <code>secret</code> to sign-in into firebase account.
|
|
180
|
+
* In order to retrieve those tokens follow instructions for iOS and Android from Firebase docs.
|
|
181
|
+
* @param {string} token Twitter's token string
|
|
182
|
+
* @param {string} secret Twitter's secret string
|
|
183
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
184
|
+
*
|
|
185
|
+
* @see https://firebase.google.com/docs/auth/android/twitter-login
|
|
186
|
+
* @see https://firebase.google.com/docs/auth/ios/twitter-login
|
|
187
|
+
*/
|
|
188
|
+
function(token, secret) {
|
|
189
|
+
return new Promise(function(resolve, reject) {
|
|
190
|
+
exec(resolve, reject, PLUGIN_NAME, "signInWithTwitter", [token, secret]);
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
exports.signInWithApple =
|
|
195
|
+
/**
|
|
196
|
+
* Uses Apples's <code>idToken</code> and <code>rawNonce</code> to sign-in into firebase account. For getting _idToken_ (_rawNonce_ is optional) you can use `cordova-plugin-sign-in-with-apple` (or any other cordova plugin for Apple Sign-In).
|
|
197
|
+
* @param {string} idToken Apple's ID token string
|
|
198
|
+
* @param {string} rawNonce Apple's raw token string
|
|
199
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
200
|
+
*
|
|
201
|
+
* @see https://firebase.google.com/docs/auth/android/apple
|
|
202
|
+
* @see https://firebase.google.com/docs/auth/ios/apple
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* // below we use cordova-plugin-sign-in-with-apple to trigger Apple Login UI
|
|
206
|
+
* cordova.plugins.SignInWithApple.signin({
|
|
207
|
+
* requestedScopes: [0, 1]
|
|
208
|
+
* }, function(res) {
|
|
209
|
+
* cordova.plugins.firebase.auth.signInWithApple(res.identityToken).then(function() {
|
|
210
|
+
* console.log("Firebase logged in with Apple");
|
|
211
|
+
* }, function(err) {
|
|
212
|
+
* console.error("Firebase login failed", err);
|
|
213
|
+
* });
|
|
214
|
+
* }, function(err) {
|
|
215
|
+
* console.error("Apple signin failed", err);
|
|
216
|
+
* });
|
|
217
|
+
*/
|
|
218
|
+
function(idToken, rawNonce) {
|
|
219
|
+
return new Promise(function(resolve, reject) {
|
|
220
|
+
exec(resolve, reject, PLUGIN_NAME, "signInWithApple", [idToken, rawNonce || null]);
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
exports.signInWithCustomToken =
|
|
225
|
+
/**
|
|
226
|
+
* You can integrate Firebase Authentication with a custom authentication system
|
|
227
|
+
* by modifying your authentication server to produce custom signed tokens when
|
|
228
|
+
* a user successfully signs in. Your app receives this token and uses it to
|
|
229
|
+
* authenticate with Firebase.
|
|
230
|
+
* @param {string} authToken Custom auth token
|
|
231
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
232
|
+
*
|
|
233
|
+
* @see https://firebase.google.com/docs/auth/android/custom-auth
|
|
234
|
+
* @see https://firebase.google.com/docs/auth/ios/custom-auth
|
|
235
|
+
*/
|
|
236
|
+
function(authToken) {
|
|
237
|
+
return new Promise(function (resolve, reject) {
|
|
238
|
+
exec(resolve, reject, PLUGIN_NAME, "signInWithCustomToken", [authToken]);
|
|
239
|
+
})
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
exports.signOut =
|
|
243
|
+
/**
|
|
244
|
+
* Signs out the current user and clears it from the disk cache.
|
|
245
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* cordova.plugins.firebase.auth.signOut();
|
|
249
|
+
*/
|
|
250
|
+
function() {
|
|
251
|
+
return new Promise(function(resolve, reject) {
|
|
252
|
+
exec(resolve, reject, PLUGIN_NAME, "signOut", []);
|
|
253
|
+
});
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
exports.verifyPhoneNumber =
|
|
257
|
+
/**
|
|
258
|
+
* Starts the phone number verification process for the given phone number.
|
|
259
|
+
*
|
|
260
|
+
* Android supports auto-verify and instant device verification.
|
|
261
|
+
* <b>You must register `onAuthStateChanged` to get callback on instant verification.</b>
|
|
262
|
+
*
|
|
263
|
+
* Maximum allowed value for timeout is 2 minutes. Use 0 to disable SMS-auto-retrieval.
|
|
264
|
+
* If you specify a positive value less than 30 seconds, library will default to 30 seconds.
|
|
265
|
+
* @param {string} phoneNumber Phone number in international format
|
|
266
|
+
* @param {number} [timeoutMillis] Maximum amount of time you are willing to wait for SMS auto-retrieval to be completed by the library.
|
|
267
|
+
* @returns {Promise<string>} Fulfills promise with <code>verificationId</code> to use later for signing in
|
|
268
|
+
*/
|
|
269
|
+
function(phoneNumber, timeoutMillis) {
|
|
270
|
+
return new Promise(function(resolve, reject) {
|
|
271
|
+
exec(resolve, reject, PLUGIN_NAME, "verifyPhoneNumber", [phoneNumber, timeoutMillis]);
|
|
272
|
+
});
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
exports.signInWithVerificationId =
|
|
276
|
+
/**
|
|
277
|
+
* Completes phone number verification process and use it to sign in.
|
|
278
|
+
* @param {string} verificationId [description]
|
|
279
|
+
* @param {string} code 6-digit SMS code
|
|
280
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* cordova.plugins.firebase.auth.verifyPhoneNumber("+123456789").then(function(verificationId) {
|
|
284
|
+
* var code = prompt("Enter verification code");
|
|
285
|
+
* if (code) {
|
|
286
|
+
* return cordova.plugins.firebase.auth.signInWithVerificationId(verificationId, code);
|
|
287
|
+
* }
|
|
288
|
+
* }).catch(function(err) {
|
|
289
|
+
* console.error("Phone number verification failed", err);
|
|
290
|
+
* });
|
|
291
|
+
*/
|
|
292
|
+
function(verificationId, code) {
|
|
293
|
+
return new Promise(function(resolve, reject) {
|
|
294
|
+
exec(resolve, reject, PLUGIN_NAME, "signInWithVerificationId", [verificationId, code]);
|
|
295
|
+
});
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
exports.useEmulator =
|
|
299
|
+
/**
|
|
300
|
+
* Sets languageCode to the app’s current language.
|
|
301
|
+
* @param {string} host Emulator host name
|
|
302
|
+
* @param {number} port Emulator port
|
|
303
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* cordova.plugins.firebase.auth.useEmulator('localhost', 8000);
|
|
307
|
+
*/
|
|
308
|
+
function(host, port) {
|
|
309
|
+
return new Promise(function(resolve, reject) {
|
|
310
|
+
exec(resolve, reject, PLUGIN_NAME, "useEmulator", [host, port]);
|
|
311
|
+
});
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
exports.updateProfile =
|
|
316
|
+
/**
|
|
317
|
+
* Updates the current user's profile data.
|
|
318
|
+
* Passing a `null` value will delete the current attribute's value, but not
|
|
319
|
+
* passing a property won't change the current attribute's value.
|
|
320
|
+
* @param {{displayName: string; photoURL: string}} profileDetails User attributes.
|
|
321
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* cordova.plugins.firebase.auth.updateProfile({
|
|
325
|
+
* displayName: "Jane Q. User",
|
|
326
|
+
* photoURL: "https://example.com/jane-q-user/profile.jpg",
|
|
327
|
+
* });
|
|
328
|
+
*/
|
|
329
|
+
function(profileDetails) {
|
|
330
|
+
return new Promise(function(resolve, reject) {
|
|
331
|
+
exec(resolve, reject, PLUGIN_NAME, "updateProfile", [profileDetails || {}]);
|
|
332
|
+
});
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
exports.useAppLanguage =
|
|
336
|
+
/**
|
|
337
|
+
* Sets languageCode to the app’s current language.
|
|
338
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* cordova.plugins.firebase.auth.useAppLanguage();
|
|
342
|
+
*/
|
|
343
|
+
function() {
|
|
344
|
+
return new Promise(function(resolve, reject) {
|
|
345
|
+
exec(resolve, reject, PLUGIN_NAME, "setLanguageCode", [null]);
|
|
346
|
+
});
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
exports.useEmulator =
|
|
350
|
+
/**
|
|
351
|
+
* Sets Firebase to use auth emulator with specific settings.
|
|
352
|
+
* @param {string} host Emulator host name
|
|
353
|
+
* @param {number} port Emulator port
|
|
354
|
+
* @returns {Promise<void>} Callback when operation is completed
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* cordova.plugins.firebase.auth.useEmulator('localhost', 8000);
|
|
358
|
+
*/
|
|
359
|
+
function(host, port) {
|
|
360
|
+
return new Promise(function(resolve, reject) {
|
|
361
|
+
exec(resolve, reject, PLUGIN_NAME, "useEmulator", [host, port]);
|
|
362
|
+
});
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Represents a user's profile information in your Firebase project's user database.
|
|
367
|
+
* @typedef UserDetails
|
|
368
|
+
* @property {string} uid String used to uniquely identify your user in your Firebase project's user database
|
|
369
|
+
* @property {string} displayName Main display name of this user from the Firebase project's user database
|
|
370
|
+
* @property {string} email Main email address of the user, as stored in the Firebase project's user database.
|
|
371
|
+
* @property {boolean} emailVerified <code>true</code> if the user's email is verified.
|
|
372
|
+
* @property {string | null} phoneNumber Phone number of the user, as stored in the Firebase project's user database, or null if none exists.
|
|
373
|
+
* @property {string} photoURL URL of this user's main profile picture, as stored in the Firebase project's user database.
|
|
374
|
+
* @property {string} providerId
|
|
375
|
+
*/
|