Skip to content

Commit c0c4c47

Browse files
authored
Merge fa5c048 into ad23bb9
2 parents ad23bb9 + fa5c048 commit c0c4c47

File tree

5 files changed

+417
-48
lines changed

5 files changed

+417
-48
lines changed

packages-exp/auth-exp/src/core/errors.ts

+30-45
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ const ERRORS: ErrorMap<AuthErrorCode> = {
112112
'This operation is restricted to administrators only.',
113113
[AuthErrorCode.ARGUMENT_ERROR]: '',
114114
[AuthErrorCode.APP_NOT_AUTHORIZED]:
115-
"This app]: identified by the domain where it's hosted]: is not " +
115+
"This app, identified by the domain where it's hosted, is not " +
116116
'authorized to use Firebase Authentication with the provided API key. ' +
117117
'Review your key configuration in the Google API console.',
118118
[AuthErrorCode.APP_NOT_INSTALLED]:
119119
'The requested mobile application corresponding to the identifier (' +
120120
'Android package name or iOS bundle ID) provided is not installed on ' +
121121
'this device.',
122122
[AuthErrorCode.CAPTCHA_CHECK_FAILED]:
123-
'The reCAPTCHA response token provided is either invalid]: expired]: ' +
123+
'The reCAPTCHA response token provided is either invalid, expired, ' +
124124
'already used or the domain associated with it does not match the list ' +
125125
'of whitelisted domains.',
126126
[AuthErrorCode.CODE_EXPIRED]:
@@ -136,15 +136,13 @@ const ERRORS: ErrorMap<AuthErrorCode> = {
136136
'This operation is sensitive and requires recent authentication. Log in ' +
137137
'again before retrying this request.',
138138
[AuthErrorCode.DYNAMIC_LINK_NOT_ACTIVATED]:
139-
'Please activate ' +
140-
'Dynamic Links in the Firebase Console and agree to the terms and ' +
139+
'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +
141140
'conditions.',
142141
[AuthErrorCode.EMAIL_EXISTS]:
143142
'The email address is already in use by another account.',
144-
[AuthErrorCode.EXPIRED_OOB_CODE]: 'The action code has expired. ',
143+
[AuthErrorCode.EXPIRED_OOB_CODE]: 'The action code has expired.',
145144
[AuthErrorCode.EXPIRED_POPUP_REQUEST]:
146-
'This operation has been cancelled due to another conflicting popup ' +
147-
'being opened.',
145+
'This operation has been cancelled due to another conflicting popup being opened.',
148146
[AuthErrorCode.INTERNAL_ERROR]: 'An internal AuthError has occurred.',
149147
[AuthErrorCode.INVALID_APP_CREDENTIAL]:
150148
'The phone verification request contains an invalid application verifier.' +
@@ -153,7 +151,7 @@ const ERRORS: ErrorMap<AuthErrorCode> = {
153151
'The mobile app identifier is not registed for the current project.',
154152
[AuthErrorCode.INVALID_AUTH]:
155153
"This user's credential isn't valid for this project. This can happen " +
156-
"if the user's token has been tampered with]: or if the user isn't for " +
154+
"if the user's token has been tampered with, or if the user isn't for " +
157155
'the project associated with this API key.',
158156
[AuthErrorCode.INVALID_AUTH_EVENT]: 'An internal AuthError has occurred.',
159157
[AuthErrorCode.INVALID_CODE]:
@@ -163,28 +161,24 @@ const ERRORS: ErrorMap<AuthErrorCode> = {
163161
[AuthErrorCode.INVALID_CONTINUE_URI]:
164162
'The continue URL provided in the request is invalid.',
165163
[AuthErrorCode.INVALID_CORDOVA_CONFIGURATION]:
166-
'The following' +
167-
' Cordova plugins must be installed to enable OAuth sign-in= ' +
168-
'cordova-plugin-buildinfo]: cordova-universal-links-plugin]: ' +
169-
'cordova-plugin-browsertab]: cordova-plugin-inappbrowser and ' +
164+
'The following Cordova plugins must be installed to enable OAuth sign-in: ' +
165+
'cordova-plugin-buildinfo, cordova-universal-links-plugin, ' +
166+
'cordova-plugin-browsertab, cordova-plugin-inappbrowser and ' +
170167
'cordova-plugin-customurlscheme.',
171168
[AuthErrorCode.INVALID_CUSTOM_TOKEN]:
172169
'The custom token format is incorrect. Please check the documentation.',
173170
[AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN]:
174-
'The provided ' +
175-
'dynamic link domain is not configured or authorized for the current ' +
176-
'project.',
171+
'The provided dynamic link domain is not configured or authorized for the current project.',
177172
[AuthErrorCode.INVALID_EMAIL]: 'The email address is badly formatted.',
178173
[AuthErrorCode.INVALID_API_KEY]:
179-
'Your API key is invalid]: please check you have copied it correctly.',
174+
'Your API key is invalid, please check you have copied it correctly.',
180175
[AuthErrorCode.INVALID_CERT_HASH]:
181176
'The SHA-1 certificate hash provided is invalid.',
182177
[AuthErrorCode.INVALID_IDP_RESPONSE]:
183178
'The supplied auth credential is malformed or has expired.',
184179
[AuthErrorCode.INVALID_MESSAGE_PAYLOAD]:
185-
'The email template corresponding to this action contains invalid charac' +
186-
'ters in its message. Please fix by going to the Auth email templates se' +
187-
'ction in the Firebase Console.',
180+
'The email template corresponding to this action contains invalid characters in its message. ' +
181+
'Please fix by going to the Auth email templates section in the Firebase Console.',
188182
[AuthErrorCode.INVALID_OAUTH_PROVIDER]:
189183
'EmailAuthProvider is not supported for this operation. This operation ' +
190184
'only supports OAuth providers.',
@@ -195,43 +189,38 @@ const ERRORS: ErrorMap<AuthErrorCode> = {
195189
'This domain is not authorized for OAuth operations for your Firebase ' +
196190
'project. Edit the list of authorized domains from the Firebase console.',
197191
[AuthErrorCode.INVALID_OOB_CODE]:
198-
'The action code is invalid. This can happen if the code is malformed]: ' +
199-
'expired]: or has already been used.',
192+
'The action code is invalid. This can happen if the code is malformed, ' +
193+
'expired, or has already been used.',
200194
[AuthErrorCode.INVALID_PASSWORD]:
201195
'The password is invalid or the user does not have a password.',
202196
[AuthErrorCode.INVALID_PERSISTENCE]:
203-
'The specified persistence type is invalid. It can only be local]: ' +
204-
'session or none.',
197+
'The specified persistence type is invalid. It can only be local, session or none.',
205198
[AuthErrorCode.INVALID_PHONE_NUMBER]:
206199
'The format of the phone number provided is incorrect. Please enter the ' +
207200
'phone number in a format that can be parsed into E.164 format. E.164 ' +
208-
'phone numbers are written in the format [+,[country code,[subscriber ' +
209-
'number including area code,.',
201+
'phone numbers are written in the format [+],[country code],[subscriber ' +
202+
'number including area code].',
210203
[AuthErrorCode.INVALID_PROVIDER_ID]: 'The specified provider ID is invalid.',
211204
[AuthErrorCode.INVALID_RECIPIENT_EMAIL]:
212205
'The email corresponding to this action failed to send as the provided ' +
213206
'recipient email address is invalid.',
214207
[AuthErrorCode.INVALID_SENDER]:
215-
'The email template corresponding to this action contains an invalid sen' +
216-
'der email or name. Please fix by going to the Auth email templates sect' +
217-
'ion in the Firebase Console.',
208+
'The email template corresponding to this action contains an invalid sender email or name. ' +
209+
'Please fix by going to the Auth email templates section in the Firebase Console.',
218210
[AuthErrorCode.INVALID_SESSION_INFO]:
219211
'The verification ID used to create the phone auth credential is invalid.',
220212
[AuthErrorCode.INVALID_TENANT_ID]:
221213
"The Auth instance's tenant ID is invalid.",
222214
[AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME]:
223-
'An Android ' +
224-
'Package Name must be provided if the Android App is required to be ' +
225-
'installed.',
215+
'An Android Package Name must be provided if the Android App is required to be installed.',
226216
[AuthErrorCode.MISSING_AUTH_DOMAIN]:
227-
'Be sure to include authDomain when calling firebase.initializeApp()]: ' +
217+
'Be sure to include authDomain when calling firebase.initializeApp(), ' +
228218
'by following the instructions in the Firebase console.',
229219
[AuthErrorCode.MISSING_APP_CREDENTIAL]:
230220
'The phone verification request is missing an application verifier ' +
231221
'assertion. A reCAPTCHA response token needs to be provided.',
232222
[AuthErrorCode.MISSING_CODE]:
233-
'The phone auth credential was created with an empty SMS verification ' +
234-
'code.',
223+
'The phone auth credential was created with an empty SMS verification code.',
235224
[AuthErrorCode.MISSING_CONTINUE_URI]:
236225
'A continue URL must be provided in the request.',
237226
[AuthErrorCode.MISSING_IFRAME_START]: 'An internal AuthError has occurred.',
@@ -242,7 +231,7 @@ const ERRORS: ErrorMap<AuthErrorCode> = {
242231
'SHA-256 hash of the provided raw nonce does not match the hashed nonce ' +
243232
'in the ID token payload.',
244233
[AuthErrorCode.MISSING_PHONE_NUMBER]:
245-
'To send verification codes]: provide a phone number for the recipient.',
234+
'To send verification codes, provide a phone number for the recipient.',
246235
[AuthErrorCode.MISSING_SESSION_INFO]:
247236
'The phone auth credential was created with an empty verification ID.',
248237
[AuthErrorCode.MODULE_DESTROYED]:
@@ -254,8 +243,7 @@ const ERRORS: ErrorMap<AuthErrorCode> = {
254243
'sign-in credentials. Sign in using a provider associated with this ' +
255244
'email address.',
256245
[AuthErrorCode.NETWORK_REQUEST_FAILED]:
257-
'A network AuthError (such as timeout]: interrupted connection or ' +
258-
'unreachable host) has occurred.',
246+
'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',
259247
[AuthErrorCode.NO_AUTH_EVENT]: 'An internal AuthError has occurred.',
260248
[AuthErrorCode.NO_SUCH_PROVIDER]:
261249
'User was not linked to an account with the given provider.',
@@ -264,15 +252,14 @@ const ERRORS: ErrorMap<AuthErrorCode> = {
264252
'requires a non-null user object.',
265253
[AuthErrorCode.OPERATION_NOT_ALLOWED]:
266254
'The given sign-in provider is disabled for this Firebase project. ' +
267-
'Enable it in the Firebase console]: under the sign-in method tab of the ' +
255+
'Enable it in the Firebase console, under the sign-in method tab of the ' +
268256
'Auth section.',
269257
[AuthErrorCode.OPERATION_NOT_SUPPORTED]:
270258
'This operation is not supported in the environment this application is ' +
271-
'running on. "location.protocol" must be http]: https or chrome-extension' +
259+
'running on. "location.protocol" must be http, https or chrome-extension' +
272260
' and web storage must be enabled.',
273261
[AuthErrorCode.POPUP_BLOCKED]:
274-
'Unable to establish a connection with the popup. It may have been ' +
275-
'blocked by the browser.',
262+
'Unable to establish a connection with the popup. It may have been blocked by the browser.',
276263
[AuthErrorCode.POPUP_CLOSED_BY_USER]:
277264
'The popup has been closed by the user before finalizing the operation.',
278265
[AuthErrorCode.PROVIDER_ALREADY_LINKED]:
@@ -308,14 +295,12 @@ const ERRORS: ErrorMap<AuthErrorCode> = {
308295
[AuthErrorCode.USER_DISABLED]:
309296
'The user account has been disabled by an administrator.',
310297
[AuthErrorCode.USER_MISMATCH]:
311-
'The supplied credentials do not correspond to the previously signed in ' +
312-
'user.',
298+
'The supplied credentials do not correspond to the previously signed in user.',
313299
[AuthErrorCode.USER_SIGNED_OUT]: '',
314300
[AuthErrorCode.WEAK_PASSWORD]:
315301
'The password must be 6 characters long or more.',
316302
[AuthErrorCode.WEB_STORAGE_UNSUPPORTED]:
317-
'This browser is not supported or 3rd party cookies and data may be ' +
318-
'disabled.'
303+
'This browser is not supported or 3rd party cookies and data may be disabled.'
319304
};
320305

321306
type AuthErrorParams = {

packages-exp/auth-exp/src/core/strategies/email.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
import { FirebaseError } from '@firebase/util';
1919
import { expect, use } from 'chai';
2020
import * as chaiAsPromised from 'chai-as-promised';
21+
import { restore, SinonStub, stub } from 'sinon';
2122
import * as sinonChai from 'sinon-chai';
22-
import { SinonStub, stub, restore } from 'sinon';
2323
import { mockEndpoint } from '../../../test/api/helper';
2424
import { mockAuth, testUser } from '../../../test/mock_auth';
2525
import * as mockFetch from '../../../test/mock_fetch';
2626
import { Endpoint } from '../../api';
2727
import { ServerError } from '../../api/errors';
28+
import { Operation } from '../../model/action_code_info';
2829
import { ProviderId } from '../providers';
2930
import * as location from '../util/location';
3031
import { fetchSignInMethodsForEmail, sendEmailVerification } from './email';

packages-exp/auth-exp/src/core/strategies/email.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,20 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { createAuthUri, CreateAuthUriRequest } from '../../api/authentication/create_auth_uri';
18+
import {
19+
createAuthUri,
20+
CreateAuthUriRequest
21+
} from '../../api/authentication/create_auth_uri';
1922
import * as api from '../../api/authentication/email_and_password';
2023
import { Operation } from '../../model/action_code_info';
21-
import { ActionCodeSettings, setActionCodeSettingsOnRequest } from '../../model/action_code_settings';
24+
import {
25+
ActionCodeSettings,
26+
setActionCodeSettingsOnRequest
27+
} from '../../model/action_code_settings';
2228
import { Auth } from '../../model/auth';
2329
import { User } from '../../model/user';
2430
import { getCurrentUrl, isHttpOrHttps } from '../util/location';
31+
import { Operation } from '../../model/action_code_info';
2532

2633
export async function fetchSignInMethodsForEmail(
2734
auth: Auth,

0 commit comments

Comments
 (0)