forked from googlearchive/firebase-bower
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirebase-auth-externs.js
1948 lines (1800 loc) · 68.2 KB
/
firebase-auth-externs.js
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*! @license Firebase v4.2.0
Build: rev-d6b2db4
Terms: https://firebase.google.com/terms/ */
/**
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Firebase Auth API.
* Version: 4.2.0
*
* Copyright 2017 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @externs
*/
/**
* Gets the {@link firebase.auth.Auth `Auth`} service for the default app or a
* given app.
*
* `firebase.auth()` can be called with no arguments to access the default app's
* {@link firebase.auth.Auth `Auth`} service or as `firebase.auth(app)` to
* access the {@link firebase.auth.Auth `Auth`} service associated with a
* specific app.
*
* @example
* // Get the Auth service for the default app
* var defaultAuth = firebase.auth();
*
* @example
* // Get the Auth service for a given app
* var otherAuth = firebase.auth(otherApp);
*
* @namespace
* @param {!firebase.app.App=} app
*
* @return {!firebase.auth.Auth}
*/
firebase.auth = function(app) {};
/**
* Interface that represents the credentials returned by an auth provider.
* Implementations specify the details about each auth provider's credential
* requirements.
*
* @interface
*/
firebase.auth.AuthCredential = function() {};
/**
* The authentication provider ID for the credential.
* For example, 'facebook.com', or 'google.com'.
*
* @type {string}
*/
firebase.auth.AuthCredential.prototype.providerId;
/**
* Gets the {@link firebase.auth.Auth `Auth`} service for the current app.
*
* @example
* var auth = app.auth();
* // The above is shorthand for:
* // var auth = firebase.auth(app);
*
* @return {!firebase.auth.Auth}
*/
firebase.app.App.prototype.auth = function() {};
/**
* User profile information, visible only to the Firebase project's
* apps.
*
* @interface
*/
firebase.UserInfo = function() {};
/**
* The user's unique ID.
*
* @type {string}
*/
firebase.UserInfo.prototype.uid;
/**
* The authentication provider ID for the current user.
* For example, 'facebook.com', or 'google.com'.
*
* @type {string}
*/
firebase.UserInfo.prototype.providerId;
/**
* The user's email address (if available).
* @type {?string}
*/
firebase.UserInfo.prototype.email;
/**
* The user's display name (if available).
*
* @type {?string}
*/
firebase.UserInfo.prototype.displayName;
/**
* The URL of the user's profile picture (if available).
*
* @type {?string}
*/
firebase.UserInfo.prototype.photoURL;
/**
* The user's E.164 formatted phone number (if available).
*
* @type {?string}
*/
firebase.UserInfo.prototype.phoneNumber;
/**
* A user account.
*
* @interface
* @extends {firebase.UserInfo}
*/
firebase.User;
/**
* The phone number normalized based on the E.164 standard (e.g. +16505550101)
* for the current user. This is null if the user has no phone credential linked
* to the account.
* @type {?string}
*/
firebase.User.prototype.phoneNumber;
/** @type {boolean} */
firebase.User.prototype.isAnonymous;
/**
* True if the user's email address has been verified.
* @type {boolean}
*/
firebase.User.prototype.emailVerified;
/**
* Additional provider-specific information about the user.
* @type {!Array<firebase.UserInfo>}
*/
firebase.User.prototype.providerData;
/**
* A refresh token for the user account. Use only for advanced scenarios that
* require explicitly refreshing tokens.
* @type {string}
*/
firebase.User.prototype.refreshToken;
/**
* Returns a JWT token used to identify the user to a Firebase service.
*
* Returns the current token if it has not expired, otherwise this will
* refresh the token and return a new one.
*
* This property is deprecated. Use {@link firebase.User#getIdToken} instead.
*
* @param {boolean=} forceRefresh Force refresh regardless of token
* expiration.
* @return {!firebase.Promise<string>}
* @deprecated
*/
firebase.User.prototype.getToken = function(forceRefresh) {};
/**
* Returns a JWT token used to identify the user to a Firebase service.
*
* Returns the current token if it has not expired, otherwise this will
* refresh the token and return a new one.
*
* @param {boolean=} forceRefresh Force refresh regardless of token
* expiration.
* @return {!firebase.Promise<string>}
*/
firebase.User.prototype.getIdToken = function(forceRefresh) {};
/**
* Refreshes the current user, if signed in.
*
* @return {!firebase.Promise<void>}
*/
firebase.User.prototype.reload = function() {};
/**
* Sends a verification email to a user.
*
* The verification process is completed by calling
* {@link firebase.auth.Auth#applyActionCode}
*
* @return {!firebase.Promise<void>}
*/
firebase.User.prototype.sendEmailVerification = function() {};
/**
* Links the user account with the given credentials.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/provider-already-linked</dt>
* <dd>Thrown if the provider has already been linked to the user. This error is
* thrown even if this is not the same provider's account that is currently
* linked to the user.</dd>
* <dt>auth/invalid-credential</dt>
* <dd>Thrown if the provider's credential is not valid. This can happen if it
* has already expired when calling link, or if it used invalid token(s).
* See the Firebase documentation for your provider, and make sure you pass
* in the correct parameters to the credential method.</dd>
* <dt>auth/credential-already-in-use</dt>
* <dd>Thrown if the account corresponding to the credential already exists
* among your users, or is already linked to a Firebase User.
* For example, this error could be thrown if you are upgrading an anonymous
* user to a Google user by linking a Google credential to it and the Google
* credential used is already associated with an existing Firebase Google
* user.
* The fields <code>error.email</code>, <code>error.phoneNumber</code>, and
* <code>error.credential</code> ({@link firebase.auth.AuthCredential})
* may be provided, depending on the type of credential. You can recover
* from this error by signing in with <code>error.credential</code> directly
* via {@link firebase.auth.Auth#signInWithCredential}.</dd>
* <dt>auth/email-already-in-use</dt>
* <dd>Thrown if the email corresponding to the credential already exists
* among your users. When thrown while linking a credential to an existing
* user, an <code>error.email</code> and <code>error.credential</code>
* ({@link firebase.auth.AuthCredential}) fields are also provided.
* You have to link the credential to the existing user with that email if
* you wish to continue signing in with that credential. To do so, call
* {@link firebase.auth.Auth#fetchProvidersForEmail}, sign in to
* <code>error.email</code> via one of the providers returned and then
* {@link firebase.User#linkWithCredential} the original credential to that
* newly signed in user.</dd>
* <dt>auth/operation-not-allowed</dt>
* <dd>Thrown if you have not enabled the provider in the Firebase Console. Go
* to the Firebase Console for your project, in the Auth section and the
* <strong>Sign in Method</strong> tab and configure the provider.</dd>
* <dt>auth/invalid-email</dt>
* <dd>Thrown if the email used in a
* {@link firebase.auth.EmailAuthProvider#credential} is invalid.</dd>
* <dt>auth/wrong-password</dt>
* <dd>Thrown if the password used in a
* {@link firebase.auth.EmailAuthProvider#credential} is not correct or
* when the user associated with the email does not have a password.</dd>
* <dt>auth/invalid-verification-code</dt>
* <dd>Thrown if the credential is a
* {@link firebase.auth.PhoneAuthProvider#credential} and the verification
* code of the credential is not valid.</dd>
* <dt>auth/invalid-verification-id</dt>
* <dd>Thrown if the credential is a
* {@link firebase.auth.PhoneAuthProvider#credential} and the verification
* ID of the credential is not valid.</dd>
* </dl>
*
* @param {!firebase.auth.AuthCredential} credential The auth credential.
* @return {!firebase.Promise<!firebase.User>}
*/
firebase.User.prototype.linkWithCredential = function(credential) {};
/**
* Links the user account with the given credentials, and returns any available
* additional user information, such as user name.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/provider-already-linked</dt>
* <dd>Thrown if the provider has already been linked to the user. This error is
* thrown even if this is not the same provider's account that is currently
* linked to the user.</dd>
* <dt>auth/invalid-credential</dt>
* <dd>Thrown if the provider's credential is not valid. This can happen if it
* has already expired when calling link, or if it used invalid token(s).
* See the Firebase documentation for your provider, and make sure you pass
* in the correct parameters to the credential method.</dd>
* <dt>auth/credential-already-in-use</dt>
* <dd>Thrown if the account corresponding to the credential already exists
* among your users, or is already linked to a Firebase User.
* For example, this error could be thrown if you are upgrading an anonymous
* user to a Google user by linking a Google credential to it and the Google
* credential used is already associated with an existing Firebase Google
* user.
* The fields <code>error.email</code>, <code>error.phoneNumber</code>, and
* <code>error.credential</code> ({@link firebase.auth.AuthCredential})
* may be provided, depending on the type of credential. You can recover
* from this error by signing in with <code>error.credential</code> directly
* via {@link firebase.auth.Auth#signInWithCredential}.</dd>
* <dt>auth/email-already-in-use</dt>
* <dd>Thrown if the email corresponding to the credential already exists
* among your users. When thrown while linking a credential to an existing
* user, an <code>error.email</code> and <code>error.credential</code>
* ({@link firebase.auth.AuthCredential}) fields are also provided.
* You have to link the credential to the existing user with that email if
* you wish to continue signing in with that credential. To do so, call
* {@link firebase.auth.Auth#fetchProvidersForEmail}, sign in to
* <code>error.email</code> via one of the providers returned and then
* {@link firebase.User#linkWithCredential} the original credential to that
* newly signed in user.</dd>
* <dt>auth/operation-not-allowed</dt>
* <dd>Thrown if you have not enabled the provider in the Firebase Console. Go
* to the Firebase Console for your project, in the Auth section and the
* <strong>Sign in Method</strong> tab and configure the provider.</dd>
* <dt>auth/invalid-email</dt>
* <dd>Thrown if the email used in a
* {@link firebase.auth.EmailAuthProvider#credential} is invalid.</dd>
* <dt>auth/wrong-password</dt>
* <dd>Thrown if the password used in a
* {@link firebase.auth.EmailAuthProvider#credential} is not correct or
* when the user associated with the email does not have a password.</dd>
* <dt>auth/invalid-verification-code</dt>
* <dd>Thrown if the credential is a
* {@link firebase.auth.PhoneAuthProvider#credential} and the verification
* code of the credential is not valid.</dd>
* <dt>auth/invalid-verification-id</dt>
* <dd>Thrown if the credential is a
* {@link firebase.auth.PhoneAuthProvider#credential} and the verification
* ID of the credential is not valid.</dd>
* </dl>
*
* @param {!firebase.auth.AuthCredential} credential The auth credential.
* @return {!firebase.Promise<!firebase.auth.UserCredential>}
*/
firebase.User.prototype.linkAndRetrieveDataWithCredential =
function(credential) {};
/**
* Links the user account with the given phone number.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/provider-already-linked</dt>
* <dd>Thrown if the provider has already been linked to the user. This error is
* thrown even if this is not the same provider's account that is currently
* linked to the user.</dd>
* <dt>auth/captcha-check-failed</dt>
* <dd>Thrown if the reCAPTCHA response token was invalid, expired, or if
* this method was called from a non-whitelisted domain.</dd>
* <dt>auth/invalid-phone-number</dt>
* <dd>Thrown if the phone number has an invalid format.</dd>
* <dt>auth/missing-phone-number</dt>
* <dd>Thrown if the phone number is missing.</dd>
* <dt>auth/quota-exceeded</dt>
* <dd>Thrown if the SMS quota for the Firebase project has been exceeded.</dd>
* <dt>auth/user-disabled</dt>
* <dd>Thrown if the user corresponding to the given phone number has been
* disabled.</dd>
* <dt>auth/credential-already-in-use</dt>
* <dd>Thrown if the account corresponding to the phone number already exists
* among your users, or is already linked to a Firebase User.
* The fields <code>error.phoneNumber</code> and
* <code>error.credential</code> ({@link firebase.auth.AuthCredential})
* are provided in this case. You can recover from this error by signing in
* with that credential directly via
* {@link firebase.auth.Auth#signInWithCredential}.</dd>
* <dt>auth/operation-not-allowed</dt>
* <dd>Thrown if you have not enabled the phone authentication provider in the
* Firebase Console. Go to the Firebase Console for your project, in the
* Auth section and the <strong>Sign in Method</strong> tab and configure
* the provider.</dd>
* </dl>
*
* @param {string} phoneNumber The user's phone number in E.164 format (e.g.
* +16505550101).
* @param {!firebase.auth.ApplicationVerifier} applicationVerifier
* @return {!firebase.Promise<!firebase.auth.ConfirmationResult>}
*/
firebase.User.prototype.linkWithPhoneNumber =
function(phoneNumber, applicationVerifier) {};
/**
* Unlinks a provider from a user account.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/no-such-provider</dt>
* <dd>Thrown if the user does not have this provider linked or when the
* provider ID given does not exist.</dd>
* </dt>
*
* @param {string} providerId
* @return {!firebase.Promise<!firebase.User>}
*/
firebase.User.prototype.unlink = function(providerId) {};
/**
* Re-authenticates a user using a fresh credential. Use before operations
* such as {@link firebase.User#updatePassword} that require tokens from recent
* sign-in attempts.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/user-mismatch</dt>
* <dd>Thrown if the credential given does not correspond to the user.</dd>
* <dt>auth/user-not-found</dt>
* <dd>Thrown if the credential given does not correspond to any existing user.
* </dd>
* <dt>auth/invalid-credential</dt>
* <dd>Thrown if the provider's credential is not valid. This can happen if it
* has already expired when calling link, or if it used invalid token(s).
* See the Firebase documentation for your provider, and make sure you pass
* in the correct parameters to the credential method.</dd>
* <dt>auth/invalid-email</dt>
* <dd>Thrown if the email used in a
* {@link firebase.auth.EmailAuthProvider#credential} is invalid.</dd>
* <dt>auth/wrong-password</dt>
* <dd>Thrown if the password used in a
* {@link firebase.auth.EmailAuthProvider#credential} is not correct or when
* the user associated with the email does not have a password.</dd>
* <dt>auth/invalid-verification-code</dt>
* <dd>Thrown if the credential is a
* {@link firebase.auth.PhoneAuthProvider#credential} and the verification
* code of the credential is not valid.</dd>
* <dt>auth/invalid-verification-id</dt>
* <dd>Thrown if the credential is a
* {@link firebase.auth.PhoneAuthProvider#credential} and the verification
* ID of the credential is not valid.</dd>
* </dl>
*
* @param {!firebase.auth.AuthCredential} credential
* @return {!firebase.Promise<void>}
*/
firebase.User.prototype.reauthenticateWithCredential = function(credential) {};
/**
* Re-authenticates a user using a fresh credential, and returns any available
* additional user information, such as user name. Use before operations
* such as {@link firebase.User#updatePassword} that require tokens from recent
* sign-in attempts.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/user-mismatch</dt>
* <dd>Thrown if the credential given does not correspond to the user.</dd>
* <dt>auth/user-not-found</dt>
* <dd>Thrown if the credential given does not correspond to any existing user.
* </dd>
* <dt>auth/invalid-credential</dt>
* <dd>Thrown if the provider's credential is not valid. This can happen if it
* has already expired when calling link, or if it used invalid token(s).
* See the Firebase documentation for your provider, and make sure you pass
* in the correct parameters to the credential method.</dd>
* <dt>auth/invalid-email</dt>
* <dd>Thrown if the email used in a
* {@link firebase.auth.EmailAuthProvider#credential} is invalid.</dd>
* <dt>auth/wrong-password</dt>
* <dd>Thrown if the password used in a
* {@link firebase.auth.EmailAuthProvider#credential} is not correct or when
* the user associated with the email does not have a password.</dd>
* <dt>auth/invalid-verification-code</dt>
* <dd>Thrown if the credential is a
* {@link firebase.auth.PhoneAuthProvider#credential} and the verification
* code of the credential is not valid.</dd>
* <dt>auth/invalid-verification-id</dt>
* <dd>Thrown if the credential is a
* {@link firebase.auth.PhoneAuthProvider#credential} and the verification
* ID of the credential is not valid.</dd>
* </dl>
*
* @param {!firebase.auth.AuthCredential} credential
* @return {!firebase.Promise<!firebase.auth.UserCredential>}
*/
firebase.User.prototype.reauthenticateAndRetrieveDataWithCredential =
function(credential) {};
/**
* Re-authenticates a user using a fresh credential. Use before operations
* such as {@link firebase.User#updatePassword} that require tokens from recent
* sign-in attempts.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/user-mismatch</dt>
* <dd>Thrown if the credential given does not correspond to the user.</dd>
* <dt>auth/user-not-found</dt>
* <dd>Thrown if the credential given does not correspond to any existing user.
* </dd>
* <dt>auth/captcha-check-failed</dt>
* <dd>Thrown if the reCAPTCHA response token was invalid, expired, or if
* this method was called from a non-whitelisted domain.</dd>
* <dt>auth/invalid-phone-number</dt>
* <dd>Thrown if the phone number has an invalid format.</dd>
* <dt>auth/missing-phone-number</dt>
* <dd>Thrown if the phone number is missing.</dd>
* <dt>auth/quota-exceeded</dt>
* <dd>Thrown if the SMS quota for the Firebase project has been exceeded.</dd>
* </dl>
*
* @param {string} phoneNumber The user's phone number in E.164 format (e.g.
* +16505550101).
* @param {!firebase.auth.ApplicationVerifier} applicationVerifier
* @return {!firebase.Promise<!firebase.auth.ConfirmationResult>}
*/
firebase.User.prototype.reauthenticateWithPhoneNumber =
function(phoneNumber, applicationVerifier) {};
/**
* Updates the user's email address.
*
* An email will be sent to the original email address (if it was set) that
* allows to revoke the email address change, in order to protect them from
* account hijacking.
*
* <b>Important:</b> this is a security sensitive operation that requires the
* user to have recently signed in. If this requirement isn't met, ask the user
* to authenticate again and then call
* {@link firebase.User#reauthenticateWithCredential}.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/invalid-email</dt>
* <dd>Thrown if the email used is invalid.</dd>
* <dt>auth/email-already-in-use</dt>
* <dd>Thrown if the email is already used by another user.</dd>
* <dt>auth/requires-recent-login</dt>
* <dd>Thrown if the user's last sign-in time does not meet the security
* threshold. Use {@link firebase.User#reauthenticateWithCredential} to
* resolve. This does not apply if the user is anonymous.</dd>
* </dl>
*
* @param {string} newEmail The new email address.
* @return {!firebase.Promise<void>}
*/
firebase.User.prototype.updateEmail = function(newEmail) {};
/**
* Updates the user's password.
*
* <b>Important:</b> this is a security sensitive operation that requires the
* user to have recently signed in. If this requirement isn't met, ask the user
* to authenticate again and then call
* {@link firebase.User#reauthenticateWithCredential}.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/weak-password</dt>
* <dd>Thrown if the password is not strong enough.</dd>
* <dt>auth/requires-recent-login</dt>
* <dd>Thrown if the user's last sign-in time does not meet the security
* threshold. Use {@link firebase.User#reauthenticateWithCredential} to
* resolve. This does not apply if the user is anonymous.</dd>
* </dl>
*
* @param {string} newPassword
* @return {!firebase.Promise<void>}
*/
firebase.User.prototype.updatePassword = function(newPassword) {};
/**
* Updates the user's phone number.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/invalid-verification-code</dt>
* <dd>Thrown if the verification code of the credential is not valid.</dd>
* <dt>auth/invalid-verification-id</dt>
* <dd>Thrown if the verification ID of the credential is not valid.</dd>
* </dl>
*
* @param {!firebase.auth.AuthCredential} phoneCredential
* @return {!firebase.Promise<void>}
*/
firebase.User.prototype.updatePhoneNumber = function(phoneCredential) {};
/**
* Updates a user's profile data.
*
* @example
* // Updates the user attributes:
* user.updateProfile({
* displayName: "Jane Q. User",
* photoURL: "https://example.com/jane-q-user/profile.jpg"
* }).then(function() {
* // Profile updated successfully!
* // "Jane Q. User"
* var displayName = user.displayName;
* // "https://example.com/jane-q-user/profile.jpg"
* var photoURL = user.photoURL;
* }, function(error) {
* // An error happened.
* });
*
* // Passing a null value will delete the current attribute's value, but not
* // passing a property won't change the current attribute's value:
* // Let's say we're using the same user than before, after the update.
* user.updateProfile({photoURL: null}).then(function() {
* // Profile updated successfully!
* // "Jane Q. User", hasn't changed.
* var displayName = user.displayName;
* // Now, this is null.
* var photoURL = user.photoURL;
* }, function(error) {
* // An error happened.
* });
*
* @param {!{displayName: ?string, photoURL: ?string}} profile The profile's
* displayName and photoURL to update.
* @return {!firebase.Promise<void>}
*/
firebase.User.prototype.updateProfile = function(profile) {};
/**
* Deletes and signs out the user.
*
* <b>Important:</b> this is a security sensitive operation that requires the
* user to have recently signed in. If this requirement isn't met, ask the user
* to authenticate again and then call
* {@link firebase.User#reauthenticateWithCredential}.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/requires-recent-login</dt>
* <dd>Thrown if the user's last sign-in time does not meet the security
* threshold. Use {@link firebase.User#reauthenticateWithCredential} to
* resolve. This does not apply if the user is anonymous.</dd>
* </dl>
*
* @return {!firebase.Promise<void>}
*/
firebase.User.prototype.delete = function() {};
/**
* Returns a JSON-serializable representation of this object.
*
* @return {!Object} A JSON-serializable representation of this object.
*/
firebase.User.prototype.toJSON = function() {};
/**
* Checks a password reset code sent to the user by email or other out-of-band
* mechanism.
*
* Returns the user's email address if valid.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/expired-action-code</dt>
* <dd>Thrown if the password reset code has expired.</dd>
* <dt>auth/invalid-action-code</dt>
* <dd>Thrown if the password reset code is invalid. This can happen if the code
* is malformed or has already been used.</dd>
* <dt>auth/user-disabled</dt>
* <dd>Thrown if the user corresponding to the given password reset code has
* been disabled.</dd>
* <dt>auth/user-not-found</dt>
* <dd>Thrown if there is no user corresponding to the password reset code. This
* may have happened if the user was deleted between when the code was
* issued and when this method was called.</dd>
* </dl>
*
* @param {string} code A verification code sent to the user.
* @return {!firebase.Promise<string>}
*/
firebase.auth.Auth.prototype.verifyPasswordResetCode = function(code) {};
/**
* A response from {@link firebase.auth.Auth#checkActionCode}.
*
* @interface
*/
firebase.auth.ActionCodeInfo = function() {};
/**
* The email address associated with the action code.
*
* @typedef {{
* email: string
* }}
*/
firebase.auth.ActionCodeInfo.prototype.data;
/**
* Checks a verification code sent to the user by email or other out-of-band
* mechanism.
*
* Returns metadata about the code.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/expired-action-code</dt>
* <dd>Thrown if the action code has expired.</dd>
* <dt>auth/invalid-action-code</dt>
* <dd>Thrown if the action code is invalid. This can happen if the code is
* malformed or has already been used.</dd>
* <dt>auth/user-disabled</dt>
* <dd>Thrown if the user corresponding to the given action code has been
* disabled.</dd>
* <dt>auth/user-not-found</dt>
* <dd>Thrown if there is no user corresponding to the action code. This may
* have happened if the user was deleted between when the action code was
* issued and when this method was called.</dd>
* </dl>
*
* @param {string} code A verification code sent to the user.
* @return {!firebase.Promise<!firebase.auth.ActionCodeInfo>}
*/
firebase.auth.Auth.prototype.checkActionCode = function(code) {};
/**
* Applies a verification code sent to the user by email or other out-of-band
* mechanism.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/expired-action-code</dt>
* <dd>Thrown if the action code has expired.</dd>
* <dt>auth/invalid-action-code</dt>
* <dd>Thrown if the action code is invalid. This can happen if the code is
* malformed or has already been used.</dd>
* <dt>auth/user-disabled</dt>
* <dd>Thrown if the user corresponding to the given action code has been
* disabled.</dd>
* <dt>auth/user-not-found</dt>
* <dd>Thrown if there is no user corresponding to the action code. This may
* have happened if the user was deleted between when the action code was
* issued and when this method was called.</dd>
* </dl>
*
* @param {string} code A verification code sent to the user.
* @return {!firebase.Promise<void>}
*/
firebase.auth.Auth.prototype.applyActionCode = function(code) {};
/**
* The Firebase Auth service interface.
*
* Do not call this constructor directly. Instead, use
* {@link firebase.auth `firebase.auth()`}.
*
* See
* {@link https://firebase.google.com/docs/auth/ Firebase Authentication}
* for a full guide on how to use the Firebase Auth service.
*
* @interface
*/
firebase.auth.Auth = function() {};
/**
* The {@link firebase.app.App app} associated with the `Auth` service
* instance.
*
* @example
* var app = auth.app;
*
* @type {!firebase.app.App}
*/
firebase.auth.Auth.prototype.app;
/**
* The currently signed-in user (or null).
*
* @type {firebase.User|null}
*/
firebase.auth.Auth.prototype.currentUser;
/**
* @enum {string}
* An enumeration of the possible persistence mechanism types.
*/
firebase.auth.Auth.Persistence = {
/**
* Indicates that the state will be persisted even when the browser window is
* closed or the activity is destroyed in react-native.
*/
LOCAL: 'local',
/**
* Indicates that the state will only be stored in memory and will be cleared
* when the window or activity is refreshed.
*/
NONE: 'none',
/**
* Indicates that the state will only persist in current session/tab, relevant
* to web only, and will be cleared when the tab is closed.
*/
SESSION: 'session'
};
/**
* Changes the current type of persistence on the current Auth instance for the
* currently saved Auth session and applies this type of persistence for
* future sign-in requests, including sign-in with redirect requests. This will
* return a promise that will resolve once the state finishes copying from one
* type of storage to the other.
* Calling a sign-in method after changing persistence will wait for that
* persistence change to complete before applying it on the new Auth state.
*
* This makes it easy for a user signing in to specify whether their session
* should be remembered or not. It also makes it easier to never persist the
* Auth state for applications that are shared by other users or have sensitive
* data.
*
* The default for web browser apps and React Native apps is 'local' (provided
* the browser supports this mechanism) whereas it is 'none' for Node.js backend
* apps.
*
* <h4>Error Codes (thrown synchronously)</h4>
* <dl>
* <dt>auth/invalid-persistence-type</dt>
* <dd>Thrown if the specified persistence type is invalid.</dd>
* <dt>auth/unsupported-persistence-type</dt>
* <dd>Thrown if the current environment does not support the specified
* persistence type.</dd>
* </dl>
*
* @example
* firebase.auth().setPersistence(firebase.auth.Auth.Persistence.SESSION)
* .then(function() {
* // Existing and future Auth states are now persisted in the current
* // session only. Closing the window would clear any existing state even if
* // a user forgets to sign out.
* });
*
* @param {!firebase.auth.Auth.Persistence} persistence The auth state
* persistence mechanism.
* @return {!firebase.Promise<void>}
*/
firebase.auth.Auth.prototype.setPersistence = function(persistence) {};
/**
* Creates a new user account associated with the specified email address and
* password.
*
* On successful creation of the user account, this user will also be
* signed in to your application.
*
* User account creation can fail if the account already exists or the password
* is invalid.
*
* Note: The email address acts as a unique identifier for the user and
* enables an email-based password reset. This function will create
* a new user account and set the initial user password.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/email-already-in-use</dt>
* <dd>Thrown if there already exists an account with the given email
* address.</dd>
* <dt>auth/invalid-email</dt>
* <dd>Thrown if the email address is not valid.</dd>
* <dt>auth/operation-not-allowed</dt>
* <dd>Thrown if email/password accounts are not enabled. Enable email/password
* accounts in the Firebase Console, under the Auth tab.</dd>
* <dt>auth/weak-password</dt>
* <dd>Thrown if the password is not strong enough.</dd>
* </dl>
*
* @example
* firebase.auth().createUserWithEmailAndPassword(email, password)
* .catch(function(error) {
* // Handle Errors here.
* var errorCode = error.code;
* var errorMessage = error.message;
* if (errorCode == 'auth/weak-password') {
* alert('The password is too weak.');
* } else {
* alert(errorMessage);
* }
* console.log(error);
* });
*
* @param {string} email The user's email address.
* @param {string} password The user's chosen password.
* @return {!firebase.Promise<!firebase.User>}
*/
firebase.auth.Auth.prototype.createUserWithEmailAndPassword =
function(email, password) {};
/**
* Gets the list of provider IDs that can be used to sign in for the given email
* address. Useful for an "identifier-first" sign-in flow.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/invalid-email</dt>
* <dd>Thrown if the email address is not valid.</dd>
* </dl>
*
* @param {string} email An email address.
* @return {!firebase.Promise<!Array<string>>}
*/
firebase.auth.Auth.prototype.fetchProvidersForEmail = function(email) {};
/**
* Adds an observer for changes to the user's sign-in state.
*
* Prior to 4.0.0, this triggered the observer when users were signed in,
* signed out, or when the user's ID token changed in situations such as token
* expiry or password change. After 4.0.0, the observer is only triggered
* on sign-in or sign-out.
*
* To keep the old behavior, see {@link firebase.auth.Auth#onIdTokenChanged}.
*
* @example
* firebase.auth().onAuthStateChanged(function(user) {
* if (user) {
* // User is signed in.
* }
* });
*
* @param {!firebase.Observer<firebase.User, firebase.auth.Error>|function(?firebase.User)}
* nextOrObserver An observer object or a function triggered on change.
* @param {function(!firebase.auth.Error)=} error Optional A function
* triggered on auth error.
* @param {firebase.CompleteFn=} completed Optional A function triggered when the
* observer is removed.
* @return {!firebase.Unsubscribe} The unsubscribe function for the observer.
*/
firebase.auth.Auth.prototype.onAuthStateChanged = function(
nextOrObserver, error, completed) {};
/**
* Adds an observer for changes to the signed-in user's ID token, which includes
* sign-in, sign-out, and token refresh events. This method has the same
* behavior as {@link firebase.auth.Auth#onAuthStateChanged} had prior to 4.0.0.
*
* @example
* firebase.auth().onIdTokenChanged(function(user) {
* if (user) {
* // User is signed in or token was refreshed.
* }
* });
*
* @param {!firebase.Observer<firebase.User, firebase.auth.Error>|function(?firebase.User)}
* nextOrObserver An observer object or a function triggered on change.
* @param {function(!firebase.auth.Error)=} error Optional A function
* triggered on auth error.
* @param {firebase.CompleteFn=} completed Optional A function triggered when the
* observer is removed.
* @return {!firebase.Unsubscribe} The unsubscribe function for the observer.
*/
firebase.auth.Auth.prototype.onIdTokenChanged = function(
nextOrObserver, error, completed) {};
/**
* Sends a password reset email to the given email address.
*
* To complete the password reset, call
* {@link firebase.auth.Auth#confirmPasswordReset} with the code supplied in the
* email sent to the user, along with the new password specified by the user.
*
* <h4>Error Codes</h4>
* <dl>
* <dt>auth/invalid-email</dt>
* <dd>Thrown if the email address is not valid.</dd>
* <dt>auth/user-not-found</dt>
* <dd>Thrown if there is no user corresponding to the email address.</dd>
* </dl>
*
* @param {string} email The email address with the password to be reset.
* @return {!firebase.Promise<void>}
*/