Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create handleRecaptchaFlow helper method #7666

Merged
merged 5 commits into from
Oct 13, 2023
Merged

Conversation

renkelvin
Copy link

@renkelvin renkelvin commented Sep 28, 2023

All flows manually verified in the demo app. Gonna add the unit tests in a separate PR.

@changeset-bot
Copy link

changeset-bot bot commented Sep 28, 2023

🦋 Changeset detected

Latest commit: edc0f50

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@firebase/auth Patch
@firebase/auth-compat Patch
firebase Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 28, 2023

Size Report 1

Affected Products

  • @firebase/auth

    TypeBase (02e2518)Merge (3d27821)Diff
    browser177 kB175 kB-2.08 kB (-1.2%)
    cordova206 kB203 kB-3.04 kB (-1.5%)
    esm5231 kB228 kB-3.04 kB (-1.3%)
    main175 kB172 kB-3.07 kB (-1.7%)
    module177 kB175 kB-2.08 kB (-1.2%)
    react-native190 kB187 kB-3.08 kB (-1.6%)
  • @firebase/auth/cordova

    TypeBase (02e2518)Merge (3d27821)Diff
    browser206 kB203 kB-3.04 kB (-1.5%)
    module206 kB203 kB-3.04 kB (-1.5%)
  • @firebase/auth/internal

    TypeBase (02e2518)Merge (3d27821)Diff
    browser188 kB186 kB-2.08 kB (-1.1%)
    esm5244 kB241 kB-3.04 kB (-1.2%)
    main211 kB208 kB-3.08 kB (-1.5%)
    module188 kB186 kB-2.08 kB (-1.1%)
  • bundle

    TypeBase (02e2518)Merge (3d27821)Diff
    auth (EmailAndPassword)80.0 kB80.0 kB+28 B (+0.0%)
  • firebase

    TypeBase (02e2518)Merge (3d27821)Diff
    firebase-auth-compat.js136 kB135 kB-1.22 kB (-0.9%)
    firebase-auth-cordova.js174 kB172 kB-2.31 kB (-1.3%)
    firebase-auth.js147 kB145 kB-1.56 kB (-1.1%)
    firebase-compat.js778 kB777 kB-1.22 kB (-0.2%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/C6lDJaFSvq.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 29, 2023

Size Analysis Report 1

Affected Products

  • @firebase/auth

    • EmailAuthCredential

      Size

      TypeBase (02e2518)Merge (3d27821)Diff
      size41.7 kB41.7 kB+28 B (+0.1%)
      size-with-ext-deps62.5 kB62.5 kB+28 B (+0.0%)

      Dependency

      TypeBase (02e2518)Merge (3d27821)Diff
      functions

      61 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _loadJS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _prodErrorMap
      _reloadWithoutSaving
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getRecaptchaConfig
      getScriptParentElement
      getVersionForPlatform
      injectRecaptchaFields
      isEnterprise
      isUserInvalidated
      mergeProviderData
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      signInWithEmailLink$1
      signInWithEmailLinkForLinking
      signInWithPassword
      updateEmailPassword
      utcTimestampToDateString

      62 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _loadJS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _prodErrorMap
      _reloadWithoutSaving
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getRecaptchaConfig
      getScriptParentElement
      getVersionForPlatform
      handleRecaptchaFlow
      injectRecaptchaFields
      isEnterprise
      isUserInvalidated
      mergeProviderData
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      signInWithEmailLink$1
      signInWithEmailLinkForLinking
      signInWithPassword
      updateEmailPassword
      utcTimestampToDateString

      + handleRecaptchaFlow

    • EmailAuthProvider

      Size

      TypeBase (02e2518)Merge (3d27821)Diff
      size43.1 kB43.2 kB+28 B (+0.1%)
      size-with-ext-deps64.2 kB64.2 kB+28 B (+0.0%)

      Dependency

      TypeBase (02e2518)Merge (3d27821)Diff
      functions

      63 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _loadJS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _prodErrorMap
      _reloadWithoutSaving
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getRecaptchaConfig
      getScriptParentElement
      getVersionForPlatform
      injectRecaptchaFields
      isEnterprise
      isUserInvalidated
      mergeProviderData
      parseDeepLink
      parseMode
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      signInWithEmailLink$1
      signInWithEmailLinkForLinking
      signInWithPassword
      updateEmailPassword
      utcTimestampToDateString

      64 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _loadJS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _prodErrorMap
      _reloadWithoutSaving
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getRecaptchaConfig
      getScriptParentElement
      getVersionForPlatform
      handleRecaptchaFlow
      injectRecaptchaFields
      isEnterprise
      isUserInvalidated
      mergeProviderData
      parseDeepLink
      parseMode
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      signInWithEmailLink$1
      signInWithEmailLinkForLinking
      signInWithPassword
      updateEmailPassword
      utcTimestampToDateString

      + handleRecaptchaFlow

    • createUserWithEmailAndPassword

      Size

      TypeBase (02e2518)Merge (3d27821)Diff
      size40.8 kB40.9 kB+92 B (+0.2%)
      size-with-ext-deps61.6 kB61.7 kB+92 B (+0.1%)

      Dependency

      TypeBase (02e2518)Merge (3d27821)Diff
      functions

      61 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _loadJS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _prodErrorMap
      _reloadWithoutSaving
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      createUserWithEmailAndPassword
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getRecaptchaConfig
      getScriptParentElement
      getVersionForPlatform
      injectRecaptchaFields
      isEnterprise
      isUserInvalidated
      mergeProviderData
      providerIdForResponse
      recachePasswordPolicy
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      signUp
      utcTimestampToDateString

      62 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _loadJS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _prodErrorMap
      _reloadWithoutSaving
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      createUserWithEmailAndPassword
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getRecaptchaConfig
      getScriptParentElement
      getVersionForPlatform
      handleRecaptchaFlow
      injectRecaptchaFields
      isEnterprise
      isUserInvalidated
      mergeProviderData
      providerIdForResponse
      recachePasswordPolicy
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      signUp
      utcTimestampToDateString

      + handleRecaptchaFlow

    • sendPasswordResetEmail

      Size

      TypeBase (02e2518)Merge (3d27821)Diff
      size40.5 kB40.5 kB+11 B (+0.0%)
      size-with-ext-deps61.3 kB61.3 kB+11 B (+0.0%)

      Dependency

      TypeBase (02e2518)Merge (3d27821)Diff
      functions

      60 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _loadJS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _persistenceKeyName
      _prodErrorMap
      _reloadWithoutSaving
      _setActionCodeSettingsOnRequest
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getRecaptchaConfig
      getScriptParentElement
      getVersionForPlatform
      injectRecaptchaFields
      isEnterprise
      isUserInvalidated
      mergeProviderData
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      sendOobCode
      sendPasswordResetEmail
      sendPasswordResetEmail$1
      utcTimestampToDateString

      61 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _loadJS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _persistenceKeyName
      _prodErrorMap
      _reloadWithoutSaving
      _setActionCodeSettingsOnRequest
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getRecaptchaConfig
      getScriptParentElement
      getVersionForPlatform
      handleRecaptchaFlow
      injectRecaptchaFields
      isEnterprise
      isUserInvalidated
      mergeProviderData
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      sendOobCode
      sendPasswordResetEmail
      sendPasswordResetEmail$1
      utcTimestampToDateString

      + handleRecaptchaFlow

    • sendSignInLinkToEmail

      Size

      TypeBase (02e2518)Merge (3d27821)Diff
      size40.5 kB40.6 kB+34 B (+0.1%)
      size-with-ext-deps61.3 kB61.3 kB+34 B (+0.1%)

      Dependency

      TypeBase (02e2518)Merge (3d27821)Diff
      functions

      60 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _loadJS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _persistenceKeyName
      _prodErrorMap
      _reloadWithoutSaving
      _setActionCodeSettingsOnRequest
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getRecaptchaConfig
      getScriptParentElement
      getVersionForPlatform
      injectRecaptchaFields
      isEnterprise
      isUserInvalidated
      mergeProviderData
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      sendOobCode
      sendSignInLinkToEmail
      sendSignInLinkToEmail$1
      utcTimestampToDateString

      61 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _loadJS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _persistenceKeyName
      _prodErrorMap
      _reloadWithoutSaving
      _setActionCodeSettingsOnRequest
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getRecaptchaConfig
      getScriptParentElement
      getVersionForPlatform
      handleRecaptchaFlow
      injectRecaptchaFields
      isEnterprise
      isUserInvalidated
      mergeProviderData
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      sendOobCode
      sendSignInLinkToEmail
      sendSignInLinkToEmail$1
      utcTimestampToDateString

      + handleRecaptchaFlow

    • signInWithEmailAndPassword

      Size

      TypeBase (02e2518)Merge (3d27821)Diff
      size44.8 kB44.8 kB+28 B (+0.1%)
      size-with-ext-deps65.8 kB65.8 kB+28 B (+0.0%)

      Dependency

      TypeBase (02e2518)Merge (3d27821)Diff
      functions

      69 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _loadJS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _processCredentialSavingMfaContextIfNecessary
      _prodErrorMap
      _reloadWithoutSaving
      _signInWithCredential
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getRecaptchaConfig
      getScriptParentElement
      getVersionForPlatform
      injectRecaptchaFields
      isEnterprise
      isUserInvalidated
      mergeProviderData
      parseDeepLink
      parseMode
      providerIdForResponse
      recachePasswordPolicy
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      signInWithCredential
      signInWithEmailAndPassword
      signInWithEmailLink$1
      signInWithEmailLinkForLinking
      signInWithPassword
      updateEmailPassword
      utcTimestampToDateString

      70 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _loadJS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _processCredentialSavingMfaContextIfNecessary
      _prodErrorMap
      _reloadWithoutSaving
      _signInWithCredential
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getRecaptchaConfig
      getScriptParentElement
      getVersionForPlatform
      handleRecaptchaFlow
      injectRecaptchaFields
      isEnterprise
      isUserInvalidated
      mergeProviderData
      parseDeepLink
      parseMode
      providerIdForResponse
      recachePasswordPolicy
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      signInWithCredential
      signInWithEmailAndPassword
      signInWithEmailLink$1
      signInWithEmailLinkForLinking
      signInWithPassword
      updateEmailPassword
      utcTimestampToDateString

      + handleRecaptchaFlow

    • signInWithEmailLink

      Size

      TypeBase (02e2518)Merge (3d27821)Diff
      size44.8 kB44.8 kB+28 B (+0.1%)
      size-with-ext-deps65.8 kB65.8 kB+28 B (+0.0%)

      Dependency

      TypeBase (02e2518)Merge (3d27821)Diff
      functions

      69 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getCurrentUrl
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _loadJS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _processCredentialSavingMfaContextIfNecessary
      _prodErrorMap
      _reloadWithoutSaving
      _signInWithCredential
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getRecaptchaConfig
      getScriptParentElement
      getVersionForPlatform
      injectRecaptchaFields
      isEnterprise
      isUserInvalidated
      mergeProviderData
      parseDeepLink
      parseMode
      providerIdForResponse
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      signInWithCredential
      signInWithEmailLink
      signInWithEmailLink$1
      signInWithEmailLinkForLinking
      signInWithPassword
      updateEmailPassword
      utcTimestampToDateString

      70 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getCurrentUrl
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _loadJS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _processCredentialSavingMfaContextIfNecessary
      _prodErrorMap
      _reloadWithoutSaving
      _signInWithCredential
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getRecaptchaConfig
      getScriptParentElement
      getVersionForPlatform
      handleRecaptchaFlow
      injectRecaptchaFields
      isEnterprise
      isUserInvalidated
      mergeProviderData
      parseDeepLink
      parseMode
      providerIdForResponse
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      signInWithCredential
      signInWithEmailLink
      signInWithEmailLink$1
      signInWithEmailLinkForLinking
      signInWithPassword
      updateEmailPassword
      utcTimestampToDateString

      + handleRecaptchaFlow

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/bjFcU047eb.html

@renkelvin renkelvin marked this pull request as ready for review September 29, 2023 01:45
actionName: RecaptchaActionName,
actionMethod: ActionMethod<TRequest, TResponse>
): Promise<TResponse> {
if (authInstance._getRecaptchaConfig()?.emailPasswordEnabled) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also include "provider" name or enum as a parameter? Based on that, we will know whether to check emailPasswordEnabled or a different provider.

Ok to handle this the next time we add a provider too. Please add a TODO in that case.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, as an internal method, I prefer add the parameter only when needed so the context is more clear.

request: TRequest
) => Promise<TResponse>;

export async function handleRecaptchaFlow<TRequest, TResponse>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add some tests for this method? I understand that usages of this methods in the various flows are being tested.. would be good to test this too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@renkelvin can you update the description that all rCE protected flows were manually verified with the demo app?

I am ok with moving the new unit tests to a different PR to debug them.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, done.

authInstance,
request,
actionName,
actionName === RecaptchaActionName.GET_OOB_CODE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that for oobCodeFlows, we do not call the request field name as "captchaResp: token"?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, this is due to backend legacy issues.

}
});
}
return handleRecaptchaFlow(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of calling signInWithCredential in packages/auth/src/core/strategies/email_and_password.ts, can we instead duplicate a bit of code and do something like:

export function signInWithEmailAndPassword(
  auth: Auth,
  email: string,
  password: string
): Promise<UserCredential> {

        const request: SignInWithPasswordRequest = {
          returnSecureToken: true,
          email: this._email,
          password: this._password,
          clientType: RecaptchaClientType.WEB
        };
 const response = handleRecaptchaFlow(auth, request, action, signInWithPassword)
 .catch(error => {
    if (error.code === `auth/${AuthErrorCode.MFA_REQUIRED}`) {
      throw MultiFactorError._fromErrorAndOperation(
        auth,
        error,
        operationType,
        user
      );
    } else if (
      error.code === `auth/${AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS}`
    ) {
      void recachePasswordPolicy(auth);
    } else {
      throw error;
    }
  })
;

  const userCredential = await UserCredentialImpl._fromIdTokenResponse(
    auth,
    OperationType.SIGN_IN,
    response
  );

    await auth._updateCurrentUser(userCredential.user);

This will make the email login flow more consistent with the other flows in strategies/email_and_password.ts and we don't have to import any recaptcha enterprise methods here (enabling tree shaking out the JS script)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the comment here, but it is for the implementation in packages/auth/src/core/strategies/email_and_password.ts

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But doing this will not perform recaptcha enterprise wrapping if the developer is calling reauthenticateWithCredential or signInWithCredential directly... hmm.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I actually tried similar things when implementing the recapthca flow originally. I agree this part needs some refactors.

@renkelvin renkelvin merged commit 3533b32 into master Oct 13, 2023
41 checks passed
@renkelvin renkelvin deleted the recaptcha-verifier branch October 13, 2023 23:53
@google-oss-bot google-oss-bot mentioned this pull request Oct 25, 2023
@firebase firebase locked and limited conversation to collaborators Nov 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants