cordova-plugin-firebase-authentication 4.0.2 → 7.0.0

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 CHANGED
@@ -5,212 +5,612 @@
5
5
  | [![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)][donate-url] | Your help is appreciated. Create a PR, submit a bug or just grab me :beer: |
6
6
  |-|-|
7
7
 
8
+ [npm-url]: https://www.npmjs.com/package/cordova-plugin-firebase-authentication
9
+ [npm-version]: https://img.shields.io/npm/v/cordova-plugin-firebase-authentication.svg
10
+ [npm-downloads]: https://img.shields.io/npm/dm/cordova-plugin-firebase-authentication.svg
11
+ [npm-total-downloads]: https://img.shields.io/npm/dt/cordova-plugin-firebase-authentication.svg?label=total+downloads
12
+ [twitter-url]: https://twitter.com/chemerisuk
13
+ [twitter-follow]: https://img.shields.io/twitter/follow/chemerisuk.svg?style=social&label=Follow%20me
14
+ [donate-url]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FYAALBP25DP2G&source=url
15
+
8
16
  ## Index
9
17
 
10
- <!-- MarkdownTOC levels="2" autolink="true" -->
18
+ <!-- MarkdownTOC levels="2,3" autolink="true" -->
11
19
 
12
- - [Installation](#installation)
13
20
  - [Supported Platforms](#supported-platforms)
14
- - [User authorization](#user-authorization)
15
- - [Get/set user state](#getset-user-state)
21
+ - [Installation](#installation)
22
+ - [Adding required configuration files](#adding-required-configuration-files)
23
+ - [Type Aliases](#type-aliases)
24
+ - [UserDetails](#userdetails)
25
+ - [Functions](#functions)
26
+ - [createUserWithEmailAndPassword](#createuserwithemailandpassword)
27
+ - [getCurrentUser](#getcurrentuser)
28
+ - [getIdToken](#getidtoken)
29
+ - [onAuthStateChanged](#onauthstatechanged)
30
+ - [sendEmailVerification](#sendemailverification)
31
+ - [sendPasswordResetEmail](#sendpasswordresetemail)
32
+ - [signInAnonymously](#signinanonymously)
33
+ - [signInWithApple](#signinwithapple)
34
+ - [signInWithCustomToken](#signinwithcustomtoken)
35
+ - [signInWithEmailAndPassword](#signinwithemailandpassword)
36
+ - [signInWithFacebook](#signinwithfacebook)
37
+ - [signInWithGoogle](#signinwithgoogle)
38
+ - [signInWithTwitter](#signinwithtwitter)
39
+ - [signInWithVerificationId](#signinwithverificationid)
40
+ - [signOut](#signout)
41
+ - [updateProfile](#updateprofile)
42
+ - [useAppLanguage](#useapplanguage)
43
+ - [useEmulator](#useemulator)
44
+ - [verifyPhoneNumber](#verifyphonenumber)
16
45
 
17
46
  <!-- /MarkdownTOC -->
18
47
 
48
+ ## Supported Platforms
49
+
50
+ - iOS
51
+ - Android
52
+
19
53
  ## Installation
20
54
 
21
55
  cordova plugin add cordova-plugin-firebase-authentication
22
56
 
23
- Use variables `ANDROID_FIREBASE_AUTH_VERSION` or `IOS_FIREBASE_AUTH_VERSION` to override dependency versions for Firebase SDKs.
57
+ Use variables `IOS_FIREBASE_POD_VERSION` and `ANDROID_FIREBASE_BOM_VERSION` to override dependency versions for Firebase SDKs:
58
+
59
+ $ cordova plugin add cordova-plugin-firebase-authentication \
60
+ --variable IOS_FIREBASE_POD_VERSION="9.3.0" \
61
+ --variable ANDROID_FIREBASE_BOM_VERSION="30.3.1"
24
62
 
25
63
  To use phone number authentication on iOS, your app must be able to receive silent APNs notifications from Firebase. For iOS 8.0 and above silent notifications do not require explicit user consent and is therefore unaffected by a user declining to receive APNs notifications in the app. Thus, the app does not need to request user permission to receive push notifications when implementing Firebase phone number auth.
26
64
 
27
- ## Supported Platforms
65
+ ### Adding required configuration files
28
66
 
29
- - iOS
30
- - Android
67
+ Cordova supports `resource-file` tag for easy copying resources files. Firebase SDK requires `google-services.json` on Android and `GoogleService-Info.plist` on iOS platforms.
31
68
 
32
- ## User authorization
33
- Unlike v1 of the plugin in v2 you must register `onAuthStateChanged` callback to be notified when `signIn*` or `signOut` methods are completed.
69
+ 1. Put `google-services.json` and/or `GoogleService-Info.plist` into the root directory of your Cordova project
70
+ 2. Add new tag for Android platform
34
71
 
35
- ### onAuthStateChanged(_callback_)
36
- Registers a block as an auth state did change listener. To be invoked when:
37
- * The block is registered as a listener,
38
- * A user with a different UID from the current user has signed in, or
39
- * The current user has signed out.
40
-
41
- ```js
42
- cordova.plugins.firebase.auth.onAuthStateChanged(function(userInfo) {
43
- if (userInfo) {
44
- // user was signed in
45
- } else {
46
- // user was signed out
47
- }
48
- });
72
+ ```xml
73
+ <platform name="android">
74
+ ...
75
+ <resource-file src="google-services.json" target="app/google-services.json" />
76
+ </platform>
77
+ ...
78
+ <platform name="ios">
79
+ ...
80
+ <resource-file src="GoogleService-Info.plist" />
81
+ </platform>
49
82
  ```
50
83
 
51
- ### createUserWithEmailAndPassword(_email_, _password_)
52
- Tries to create a new user account with the given email address and password.
53
- ```js
84
+ <!-- TypedocGenerated -->
85
+
86
+ ## Type Aliases
87
+
88
+ ### UserDetails
89
+
90
+ **UserDetails**: `Object`
91
+
92
+ Represents a user's profile information in your Firebase project's user database.
93
+
94
+ #### Type declaration
95
+
96
+ | Name | Type | Description |
97
+ | :------ | :------ | :------ |
98
+ | `displayName` | `string` | Main display name of this user from the Firebase project's user database |
99
+ | `email` | `string` | Main email address of the user, as stored in the Firebase project's user database. |
100
+ | `emailVerified` | `boolean` | <code>true</code> if the user's email is verified. |
101
+ | `phoneNumber` | `string` \| ``null`` | Phone number of the user, as stored in the Firebase project's user database, or null if none exists. |
102
+ | `photoURL` | `string` | URL of this user's main profile picture, as stored in the Firebase project's user database. |
103
+ | `providerId` | `string` | - |
104
+ | `uid` | `string` | String used to uniquely identify your user in your Firebase project's user database |
105
+
106
+ ## Functions
107
+
108
+ ### createUserWithEmailAndPassword
109
+
110
+ **createUserWithEmailAndPassword**(`email`, `password`): `Promise`<`void`\>
111
+
112
+ Creates a new user account with the given email address and password.
113
+
114
+ **`Example`**
115
+
116
+ ```ts
54
117
  cordova.plugins.firebase.auth.createUserWithEmailAndPassword("my@mail.com", "pa55w0rd");
55
118
  ```
56
119
 
57
- ### sendEmailVerification()
120
+ #### Parameters
121
+
122
+ | Name | Type | Description |
123
+ | :------ | :------ | :------ |
124
+ | `email` | `string` | User account email |
125
+ | `password` | `string` | User accound password |
126
+
127
+ #### Returns
128
+
129
+ `Promise`<`void`\>
130
+
131
+ Callback when operation is completed
132
+
133
+ ___
134
+
135
+ ### getCurrentUser
136
+
137
+ **getCurrentUser**(): `Promise`<[`UserDetails`](#userdetails)\>
138
+
139
+ Returns the current user in the Firebase instance.
140
+
141
+ #### Returns
142
+
143
+ `Promise`<[`UserDetails`](#userdetails)\>
144
+
145
+ Fulfills promise with user details
146
+
147
+ ___
148
+
149
+ ### getIdToken
150
+
151
+ **getIdToken**(`forceRefresh`): `Promise`<`string`\>
152
+
153
+ Returns a JWT token used to identify the user to a Firebase service.
154
+
155
+ **`Example`**
156
+
157
+ ```ts
158
+ cordova.plugins.firebase.auth.getIdToken().then(function(idToken) {
159
+ // send token to server
160
+ });
161
+ ```
162
+
163
+ #### Parameters
164
+
165
+ | Name | Type | Description |
166
+ | :------ | :------ | :------ |
167
+ | `forceRefresh` | `boolean` | When <code>true</code> cached value is ignored |
168
+
169
+ #### Returns
170
+
171
+ `Promise`<`string`\>
172
+
173
+ Fulfills promis with id token string value
174
+
175
+ ___
176
+
177
+ ### onAuthStateChanged
178
+
179
+ **onAuthStateChanged**(`callback`, `errorCallback?`): () => `void`
180
+
181
+ Registers a block as an auth state did change listener. To be invoked when:
182
+ - The block is registered as a listener,
183
+ - A user with a different UID from the current user has signed in, or
184
+ - The current user has signed out.
185
+
186
+ #### Parameters
187
+
188
+ | Name | Type | Description |
189
+ | :------ | :------ | :------ |
190
+ | `callback` | (`userDetails`: [`UserDetails`](#userdetails)) => `void` | Callback function |
191
+ | `errorCallback?` | (`error`: `string`) => `void` | Error callback function |
192
+
193
+ #### Returns
194
+
195
+ `fn`
196
+
197
+ (): `void`
198
+
199
+ ##### Returns
200
+
201
+ `void`
202
+
203
+ ___
204
+
205
+ ### sendEmailVerification
206
+
207
+ **sendEmailVerification**(): `Promise`<`void`\>
208
+
58
209
  Initiates email verification for the current user.
59
- ```js
210
+
211
+ **`Example`**
212
+
213
+ ```ts
60
214
  cordova.plugins.firebase.auth.sendEmailVerification();
61
215
  ```
62
216
 
63
- ### sendPasswordResetEmail(_email_)
64
- Triggers the Firebase Authentication backend to send a password-reset email to the given email address, which must correspond to an existing user of your app.
65
- ```js
217
+ #### Returns
218
+
219
+ `Promise`<`void`\>
220
+
221
+ Callback when operation is completed
222
+
223
+ ___
224
+
225
+ ### sendPasswordResetEmail
226
+
227
+ **sendPasswordResetEmail**(`email`): `Promise`<`void`\>
228
+
229
+ Triggers the Firebase Authentication backend to send a password-reset email
230
+ to the given email address, which must correspond to an existing user of your app.
231
+
232
+ **`Example`**
233
+
234
+ ```ts
66
235
  cordova.plugins.firebase.auth.sendPasswordResetEmail("my@mail.com");
67
236
  ```
68
237
 
69
- ### signInWithEmailAndPassword(_email_, _password_)
70
- Asynchronously signs in using an email and password.
71
- ```js
72
- cordova.plugins.firebase.auth.signInWithEmailAndPassword("my@mail.com", "pa55w0rd");
238
+ #### Parameters
239
+
240
+ | Name | Type | Description |
241
+ | :------ | :------ | :------ |
242
+ | `email` | `string` | User account email |
243
+
244
+ #### Returns
245
+
246
+ `Promise`<`void`\>
247
+
248
+ Callback when operation is completed
249
+
250
+ ___
251
+
252
+ ### signInAnonymously
253
+
254
+ **signInAnonymously**(): `Promise`<`void`\>
255
+
256
+ Create and use temporary anonymous account to authenticate with Firebase.
257
+
258
+ **`Example`**
259
+
260
+ ```ts
261
+ cordova.plugins.firebase.auth.signInAnonymously();
73
262
  ```
74
263
 
75
- ### verifyPhoneNumber(_phoneNumber_, _timeout_)
76
- Starts the phone number verification process for the given phone number.
264
+ #### Returns
77
265
 
78
- NOTE: Android supports auto-verify and instant device verification. Therefore in that cases it doesn't make sense to ask for sms code. It's recommended to register `onAuthStateChanged` callback to be notified on auto sign-in.
266
+ `Promise`<`void`\>
79
267
 
80
- _timeout_ [milliseconds] is the maximum amount of time you are willing to wait for SMS auto-retrieval to be completed by the library. Maximum allowed value is 2 minutes. Use 0 to disable SMS-auto-retrieval. If you specify a positive value less than 30 seconds, library will default to 30 seconds.
268
+ Callback when operation is completed
81
269
 
82
- ```js
83
- cordova.plugins.firebase.auth.verifyPhoneNumber("+123456789").then(function(verificationId) {
84
- // pass verificationId to signInWithVerificationId
85
- }).catch(function(err) {
86
- console.error("phoner number verification failed", err);
270
+ ___
271
+
272
+ ### signInWithApple
273
+
274
+ **signInWithApple**(`idToken`, `rawNonce`): `Promise`<`void`\>
275
+
276
+ 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).
277
+
278
+ **`Example`**
279
+
280
+ ```ts
281
+ // below we use cordova-plugin-sign-in-with-apple to trigger Apple Login UI
282
+ cordova.plugins.SignInWithApple.signin({
283
+ requestedScopes: [0, 1]
284
+ }, function(res) {
285
+ cordova.plugins.firebase.auth.signInWithApple(res.identityToken).then(function() {
286
+ console.log("Firebase logged in with Apple");
287
+ }, function(err) {
288
+ console.error("Firebase login failed", err);
289
+ });
290
+ }, function(err) {
291
+ console.error("Apple signin failed", err);
87
292
  });
88
293
  ```
89
- ### signInWithVerificationId(_verificationId_, _smsCode_)
90
- Asynchronously signs in using verificationId and 6-digit SMS code.
91
294
 
92
- ```js
93
- cordova.plugins.firebase.auth.signInWithVerificationId("djgfioerjg34", "123456");
94
- ```
295
+ #### Parameters
95
296
 
297
+ | Name | Type | Description |
298
+ | :------ | :------ | :------ |
299
+ | `idToken` | `string` | Apple's ID token string |
300
+ | `rawNonce` | `string` | Apple's raw token string |
96
301
 
97
- ### signInAnonymously()
98
- Create and use temporary anonymous account to authenticate with Firebase.
99
- ```js
100
- cordova.plugins.firebase.auth.signInAnonymously();
302
+ #### Returns
303
+
304
+ `Promise`<`void`\>
305
+
306
+ Callback when operation is completed
307
+
308
+ ___
309
+
310
+ ### signInWithCustomToken
311
+
312
+ **signInWithCustomToken**(`authToken`): `Promise`<`void`\>
313
+
314
+ You can integrate Firebase Authentication with a custom authentication system
315
+ by modifying your authentication server to produce custom signed tokens when
316
+ a user successfully signs in. Your app receives this token and uses it to
317
+ authenticate with Firebase.
318
+
319
+ **`See`**
320
+
321
+ - https://firebase.google.com/docs/auth/android/custom-auth
322
+ - https://firebase.google.com/docs/auth/ios/custom-auth
323
+
324
+ #### Parameters
325
+
326
+ | Name | Type | Description |
327
+ | :------ | :------ | :------ |
328
+ | `authToken` | `string` | Custom auth token |
329
+
330
+ #### Returns
331
+
332
+ `Promise`<`void`\>
333
+
334
+ Callback when operation is completed
335
+
336
+ ___
337
+
338
+ ### signInWithEmailAndPassword
339
+
340
+ **signInWithEmailAndPassword**(`email`, `password`): `Promise`<`void`\>
341
+
342
+ Triggers the Firebase Authentication backend to send a password-reset email
343
+ to the given email address, which must correspond to an existing user of your app.
344
+
345
+ **`Example`**
346
+
347
+ ```ts
348
+ cordova.plugins.firebase.auth.signInWithEmailAndPassword("my@mail.com", "pa55w0rd");
101
349
  ```
102
350
 
103
- ### signInWithGoogle(_idToken_, _accessToken_)
104
- Uses Google's _idToken_ and _accessToken_ to sign-in into firebase account. In order to retriave those tokens you can use `cordova-plugin-googleplus` (or any other cordova plugin for Google Sign-In).
351
+ #### Parameters
105
352
 
106
- cordova plugin add cordova-plugin-firebase-authentication
107
- cordova plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid --variable WEB_APPLICATION_CLIENT_ID=mywebapplicationclientid
353
+ | Name | Type | Description |
354
+ | :------ | :------ | :------ |
355
+ | `email` | `string` | User account email |
356
+ | `password` | `string` | User accound password |
357
+
358
+ #### Returns
359
+
360
+ `Promise`<`void`\>
361
+
362
+ Callback when operation is completed
363
+
364
+ ___
365
+
366
+ ### signInWithFacebook
367
+
368
+ **signInWithFacebook**(`accessToken`): `Promise`<`void`\>
369
+
370
+ Uses Facebook's <code>accessToken</code> to sign-in into firebase account. In order to
371
+ retrieve those tokens follow instructions for iOS and Android from Firebase docs.
372
+
373
+ **`See`**
374
+
375
+ - https://firebase.google.com/docs/auth/android/facebook-login
376
+ - https://firebase.google.com/docs/auth/ios/facebook-login
377
+
378
+ #### Parameters
379
+
380
+ | Name | Type | Description |
381
+ | :------ | :------ | :------ |
382
+ | `accessToken` | `string` | Facebook's access token string |
383
+
384
+ #### Returns
385
+
386
+ `Promise`<`void`\>
387
+
388
+ Callback when operation is completed
389
+
390
+ ___
391
+
392
+ ### signInWithGoogle
393
+
394
+ **signInWithGoogle**(`idToken`, `accessToken`): `Promise`<`void`\>
108
395
 
109
- Now trigger signin dialog UI to popup:
396
+ Uses Google's <code>idToken</code> and <code>accessToken</code> to sign-in into firebase account.
110
397
 
111
- ```js
398
+ **`Example`**
399
+
400
+ ```ts
401
+ // Below we use cordova-plugin-googleplus to trigger Google Login UI
112
402
  window.plugins.googleplus.login({
113
- 'scopes': '... ', // optional, space-separated list of scopes, If not included or empty, defaults to `profile` and `email`.
114
- 'webClientId': 'client id of the web app/server side', // optional clientId of your Web application from Credentials settings of your project - On Android, this MUST be included to get an idToken. On iOS, it is not required.
115
- 'offline': true // optional, but requires the webClientId - if set to true the plugin will also return a serverAuthCode, which can be used to grant offline access to a non-Google server
403
+ scopes: '... ',
404
+ webClientId: '1234...',
405
+ offline: true
116
406
  }, function(res) {
117
- // signin into Firebase
118
407
  cordova.plugins.firebase.auth.signInWithGoogle(res.idToken, res.accessToken).then(function() {
119
408
  console.log("Firebase logged in with Google");
409
+ }, function(err) {
410
+ console.error("Firebase login failed", err);
120
411
  });
121
412
  }, function(err) {
122
- console.error("login failed", err);
413
+ console.error("Google login failed", err);
123
414
  });
124
415
  ```
125
416
 
126
- ### signInWithApple(_idToken_, _rawNonce_)
127
- Uses Apples's _idToken_ and _rawNonce_ 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).
417
+ #### Parameters
128
418
 
129
- cordova plugin add cordova-plugin-firebase-authentication
130
- cordova plugin add cordova-plugin-sign-in-with-apple
419
+ | Name | Type | Description |
420
+ | :------ | :------ | :------ |
421
+ | `idToken` | `string` | Google ID token |
422
+ | `accessToken` | `string` | Google Access token |
131
423
 
132
- Then use code snippet below to signin into Firebase:
424
+ #### Returns
133
425
 
134
- ```js
135
- cordova.plugins.SignInWithApple.signin({
136
- requestedScopes: [0, 1]
137
- }, function(res) {
138
- cordova.plugins.firebase.auth.signInWithApple(res.identityToken).then(function() {
139
- console.log("Firebase logged in with Apple");
140
- });
141
- }, function(err) {
142
- console.error("signin failed", err);
426
+ `Promise`<`void`\>
427
+
428
+ Callback when operation is completed
429
+
430
+ ___
431
+
432
+ ### signInWithTwitter
433
+
434
+ **signInWithTwitter**(`token`, `secret`): `Promise`<`void`\>
435
+
436
+ Uses Twitter's <code>token</code> and <code>secret</code> to sign-in into firebase account.
437
+ In order to retrieve those tokens follow instructions for iOS and Android from Firebase docs.
438
+
439
+ **`See`**
440
+
441
+ - https://firebase.google.com/docs/auth/android/twitter-login
442
+ - https://firebase.google.com/docs/auth/ios/twitter-login
443
+
444
+ #### Parameters
445
+
446
+ | Name | Type | Description |
447
+ | :------ | :------ | :------ |
448
+ | `token` | `string` | Twitter's token string |
449
+ | `secret` | `string` | Twitter's secret string |
450
+
451
+ #### Returns
452
+
453
+ `Promise`<`void`\>
454
+
455
+ Callback when operation is completed
456
+
457
+ ___
458
+
459
+ ### signInWithVerificationId
460
+
461
+ **signInWithVerificationId**(`verificationId`, `code`): `Promise`<`void`\>
462
+
463
+ Completes phone number verification process and use it to sign in.
464
+
465
+ **`Example`**
466
+
467
+ ```ts
468
+ cordova.plugins.firebase.auth.verifyPhoneNumber("+123456789").then(function(verificationId) {
469
+ var code = prompt("Enter verification code");
470
+ if (code) {
471
+ return cordova.plugins.firebase.auth.signInWithVerificationId(verificationId, code);
472
+ }
473
+ }).catch(function(err) {
474
+ console.error("Phone number verification failed", err);
143
475
  });
144
476
  ```
145
477
 
146
- ### signInWithFacebook(_accessToken_)
147
- Uses Facebook's _accessToken_ to sign-in into firebase account. In order to retriave those tokens follow instructions for [Android](https://firebase.google.com/docs/auth/android/facebook-login) and [iOS](https://firebase.google.com/docs/auth/ios/facebook-login).
478
+ #### Parameters
148
479
 
149
- ### signInWithTwitter(_token_, _secret_)
150
- Uses Twitter's _token_ and _secret_ to sign-in into firebase account. In order to retriave those tokens follow instructions for [Android](https://firebase.google.com/docs/auth/android/twitter-login) and [iOS](https://firebase.google.com/docs/auth/ios/twitter-login).
480
+ | Name | Type | Description |
481
+ | :------ | :------ | :------ |
482
+ | `verificationId` | `string` | [description] |
483
+ | `code` | `string` | 6-digit SMS code |
151
484
 
152
- ### signInWithCustomToken(_idToken_)
153
- You can integrate Firebase Authentication with a custom authentication system by modifying your authentication server to produce custom signed tokens when a user successfully signs in. Your app receives this token and uses it to authenticate with Firebase. See [Android](https://firebase.google.com/docs/auth/android/custom-auth) and [iOS](https://firebase.google.com/docs/auth/ios/custom-auth) for more info.
485
+ #### Returns
486
+
487
+ `Promise`<`void`\>
488
+
489
+ Callback when operation is completed
490
+
491
+ ___
492
+
493
+ ### signOut
494
+
495
+ **signOut**(): `Promise`<`void`\>
154
496
 
155
- ### signOut()
156
497
  Signs out the current user and clears it from the disk cache.
157
- ```js
498
+
499
+ **`Example`**
500
+
501
+ ```ts
158
502
  cordova.plugins.firebase.auth.signOut();
159
503
  ```
160
504
 
161
- ## Get/set user state
162
- Every method call returns a promise which is optionally fulfilled with an appropriate value.
505
+ #### Returns
163
506
 
164
- ### getCurrentUser()
165
- Returns the current user in the Firebase instance.
166
- ```js
167
- cordova.plugins.firebase.auth.getCurrentUser().then(function(userInfo) {
168
- // user information or null if not logged in
169
- })
170
- ```
507
+ `Promise`<`void`\>
171
508
 
172
- ### updateProfile()
173
- Updates the current user's profile data.
509
+ Callback when operation is completed
510
+
511
+ ___
512
+
513
+ ### updateProfile
174
514
 
515
+ **updateProfile**(`profileDetails`): `Promise`<`void`\>
516
+
517
+ Updates the current user's profile data.
175
518
  Passing a `null` value will delete the current attribute's value, but not
176
519
  passing a property won't change the current attribute's value.
177
520
 
178
- ```js
179
- cordova.plugins.firebase.auth.updateProfile({
180
- displayName: "Jane Q. User",
181
- photoURL: "https://example.com/jane-q-user/profile.jpg"
182
- }).then(function() {
183
- console.log("user profile updated");
184
- });
521
+ **`Example`**
185
522
 
186
- // Let's say we continue updating the profile of the same user as before.
523
+ ```ts
187
524
  cordova.plugins.firebase.auth.updateProfile({
188
- photoURL: null
189
- }).then(function() {
190
- // displayName is unchanged - "Jane Q. User"
191
- // photoURL is changed - null
192
- console.log("only photoURL is changed");
525
+ displayName: "Jane Q. User",
526
+ photoURL: "https://example.com/jane-q-user/profile.jpg",
193
527
  });
194
528
  ```
195
529
 
196
- ### getIdToken(_forceRefresh_)
197
- Returns a JWT token used to identify the user to a Firebase service.
198
- ```js
199
- cordova.plugins.firebase.auth.getIdToken().then(function(idToken) {
200
- // send token to server
201
- });
530
+ #### Parameters
531
+
532
+ | Name | Type | Description |
533
+ | :------ | :------ | :------ |
534
+ | `profileDetails` | `Object` | User attributes. |
535
+ | `profileDetails.displayName` | `string` | - |
536
+ | `profileDetails.photoURL` | `string` | - |
537
+
538
+ #### Returns
539
+
540
+ `Promise`<`void`\>
541
+
542
+ Callback when operation is completed
543
+
544
+ ___
545
+
546
+ ### useAppLanguage
547
+
548
+ **useAppLanguage**(): `Promise`<`void`\>
549
+
550
+ Sets languageCode to the app’s current language.
551
+
552
+ **`Example`**
553
+
554
+ ```ts
555
+ cordova.plugins.firebase.auth.useAppLanguage();
202
556
  ```
203
557
 
204
- ### setLanguageCode(_languageCode_)
205
- Set's the current user language code. The string used to set this property must be a language code that follows BCP 47.
558
+ #### Returns
559
+
560
+ `Promise`<`void`\>
561
+
562
+ Callback when operation is completed
563
+
564
+ ___
565
+
566
+ ### useEmulator
567
+
568
+ **useEmulator**(`host`, `port`): `Promise`<`void`\>
206
569
 
207
- ### useAppLanguage()
208
570
  Sets languageCode to the app’s current language.
209
571
 
210
- [npm-url]: https://www.npmjs.com/package/cordova-plugin-firebase-authentication
211
- [npm-version]: https://img.shields.io/npm/v/cordova-plugin-firebase-authentication.svg
212
- [npm-downloads]: https://img.shields.io/npm/dm/cordova-plugin-firebase-authentication.svg
213
- [npm-total-downloads]: https://img.shields.io/npm/dt/cordova-plugin-firebase-authentication.svg?label=total+downloads
214
- [twitter-url]: https://twitter.com/chemerisuk
215
- [twitter-follow]: https://img.shields.io/twitter/follow/chemerisuk.svg?style=social&label=Follow%20me
216
- [donate-url]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FYAALBP25DP2G&source=url
572
+ **`Example`**
573
+
574
+ ```ts
575
+ cordova.plugins.firebase.auth.useEmulator('localhost', 8000);
576
+ ```
577
+
578
+ #### Parameters
579
+
580
+ | Name | Type | Description |
581
+ | :------ | :------ | :------ |
582
+ | `host` | `string` | Emulator host name |
583
+ | `port` | `number` | Emulator port |
584
+
585
+ #### Returns
586
+
587
+ `Promise`<`void`\>
588
+
589
+ Callback when operation is completed
590
+
591
+ ___
592
+
593
+ ### verifyPhoneNumber
594
+
595
+ **verifyPhoneNumber**(`phoneNumber`, `timeoutMillis?`): `Promise`<`string`\>
596
+
597
+ Starts the phone number verification process for the given phone number.
598
+
599
+ Android supports auto-verify and instant device verification.
600
+ <b>You must register `onAuthStateChanged` to get callback on instant verification.</b>
601
+
602
+ Maximum allowed value for timeout is 2 minutes. Use 0 to disable SMS-auto-retrieval.
603
+ If you specify a positive value less than 30 seconds, library will default to 30 seconds.
604
+
605
+ #### Parameters
606
+
607
+ | Name | Type | Description |
608
+ | :------ | :------ | :------ |
609
+ | `phoneNumber` | `string` | Phone number in international format |
610
+ | `timeoutMillis?` | `number` | Maximum amount of time you are willing to wait for SMS auto-retrieval to be completed by the library. |
611
+
612
+ #### Returns
613
+
614
+ `Promise`<`string`\>
615
+
616
+ Fulfills promise with <code>verificationId</code> to use later for signing in