Skip to content

Conversation

@Evanition
Copy link
Contributor

@Evanition Evanition commented Jul 25, 2023

This branch contained all the changes related to webOTP Autofill.
Includes changes in

  • confirmWithWebOTP
  • overloaded verifyPhoneNumber/_verifyPhoneNumber
  • overloaded signInWithPhoneNumber
  • interfaces for webOTP typescript support
  • unit tests

@Evanition Evanition requested review from a team, lisajian, prameshj, renkelvin and sam-gc as code owners July 25, 2023 18:30
@changeset-bot
Copy link

changeset-bot bot commented Jul 25, 2023

⚠️ No Changeset found

Latest commit: e510234

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jul 25, 2023

Size Report 1

Affected Products

  • @firebase/auth

    TypeBase (43e402f)Merge (03c6862)Diff
    browser177 kB179 kB+2.17 kB (+1.2%)
    cordova206 kB206 kB+108 B (+0.1%)
    esm5231 kB233 kB+2.77 kB (+1.2%)
    main175 kB175 kB+108 B (+0.1%)
    module177 kB179 kB+2.17 kB (+1.2%)
    react-native189 kB192 kB+2.81 kB (+1.5%)
  • @firebase/auth/cordova

    TypeBase (43e402f)Merge (03c6862)Diff
    browser206 kB206 kB+108 B (+0.1%)
    module206 kB206 kB+108 B (+0.1%)
  • @firebase/auth/internal

    TypeBase (43e402f)Merge (03c6862)Diff
    browser188 kB190 kB+2.17 kB (+1.2%)
    esm5244 kB247 kB+2.77 kB (+1.1%)
    main211 kB211 kB+108 B (+0.1%)
    module188 kB190 kB+2.17 kB (+1.2%)
  • bundle

    TypeBase (43e402f)Merge (03c6862)Diff
    auth (Phone)82.9 kB84.0 kB+1.16 kB (+1.4%)
  • firebase

    TypeBase (43e402f)Merge (03c6862)Diff
    firebase-auth-compat.js136 kB137 kB+1.19 kB (+0.9%)
    firebase-auth-cordova.js174 kB174 kB+107 B (+0.1%)
    firebase-auth.js147 kB148 kB+1.49 kB (+1.0%)
    firebase-compat.js778 kB779 kB+1.20 kB (+0.2%)

Test Logs

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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jul 25, 2023

Size Analysis Report 1

Affected Products

  • @firebase/auth

    • AuthErrorCodes

      Size

      TypeBase (43e402f)Merge (03c6862)Diff
      size41.7 kB41.7 kB+51 B (+0.1%)
      size-with-ext-deps62.4 kB62.5 kB+51 B (+0.1%)
    • PhoneAuthProvider

      Size

      TypeBase (43e402f)Merge (03c6862)Diff
      size40.4 kB43.1 kB+2.70 kB (+6.7%)
      size-with-ext-deps61.2 kB63.9 kB+2.70 kB (+4.4%)

      Dependency

      TypeBase (43e402f)Merge (03c6862)Diff
      functions

      59 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
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _prodErrorMap
      _reloadWithoutSaving
      _tokenExpiresIn
      _verifyPhoneNumber
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getVersionForPlatform
      isUserInvalidated
      linkWithPhoneNumber$1
      mergeProviderData
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      sendPhoneVerificationCode
      signInWithPhoneNumber$1
      startEnrollPhoneMfa
      startSignInPhoneMfa
      utcTimestampToDateString
      verifyPhoneNumberForExisting

      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
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _processCredentialSavingMfaContextIfNecessary
      _prodErrorMap
      _reloadWithoutSaving
      _signInWithCredential
      _tokenExpiresIn
      _verifyPhoneNumber
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getVersionForPlatform
      isUserInvalidated
      linkWithPhoneNumber$1
      mergeProviderData
      providerIdForResponse
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      sendPhoneVerificationCode
      signInWithCredential
      signInWithPhoneNumber$1
      startEnrollPhoneMfa
      startSignInPhoneMfa
      utcTimestampToDateString
      verifyPhoneNumberForExisting

      + _processCredentialSavingMfaContextIfNecessary
      + _signInWithCredential
      + providerIdForResponse
      + signInWithCredential

      classes

      17 dependencies

      AuthCredential
      AuthImpl
      AuthInterop
      AuthMiddlewareQueue
      Delay
      FetchProvider
      InMemoryPersistence
      NetworkTimeout
      PasswordPolicyImpl
      PersistenceUserManager
      PhoneAuthCredential
      PhoneAuthProvider
      ProactiveRefresh
      StsTokenManager
      Subscription
      UserImpl
      UserMetadata

      20 dependencies

      AuthCredential
      AuthImpl
      AuthInterop
      AuthMiddlewareQueue
      ConfirmationResultImpl
      Delay
      FetchProvider
      InMemoryPersistence
      MultiFactorError
      NetworkTimeout
      PasswordPolicyImpl
      PersistenceUserManager
      PhoneAuthCredential
      PhoneAuthProvider
      ProactiveRefresh
      StsTokenManager
      Subscription
      UserCredentialImpl
      UserImpl
      UserMetadata

      + ConfirmationResultImpl
      + MultiFactorError
      + UserCredentialImpl

    • debugErrorMap

      Size

      TypeBase (43e402f)Merge (03c6862)Diff
      size48.8 kB48.8 kB+55 B (+0.1%)
      size-with-ext-deps69.6 kB69.6 kB+55 B (+0.1%)
    • linkWithPhoneNumber

      Size

      TypeBase (43e402f)Merge (03c6862)Diff
      size41.2 kB43.0 kB+1.88 kB (+4.6%)
      size-with-ext-deps62.0 kB63.8 kB+1.89 kB (+3.0%)

      Dependency

      TypeBase (43e402f)Merge (03c6862)Diff
      functions

      65 dependencies

      _addTidIfNecessary
      _assert
      _assertLinkedStatus
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _link$1
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _prodErrorMap
      _reloadWithoutSaving
      _tokenExpiresIn
      _verifyPhoneNumber
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getVersionForPlatform
      isUserInvalidated
      linkWithCredential
      linkWithPhoneNumber
      linkWithPhoneNumber$1
      mergeProviderData
      providerDataAsNames
      providerIdForResponse
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      sendPhoneVerificationCode
      signInWithPhoneNumber$1
      startEnrollPhoneMfa
      startSignInPhoneMfa
      utcTimestampToDateString
      verifyPhoneNumberForExisting

      68 dependencies

      _addTidIfNecessary
      _assert
      _assertLinkedStatus
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _link$1
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _processCredentialSavingMfaContextIfNecessary
      _prodErrorMap
      _reloadWithoutSaving
      _signInWithCredential
      _tokenExpiresIn
      _verifyPhoneNumber
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getVersionForPlatform
      isUserInvalidated
      linkWithCredential
      linkWithPhoneNumber
      linkWithPhoneNumber$1
      mergeProviderData
      providerDataAsNames
      providerIdForResponse
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      sendPhoneVerificationCode
      signInWithCredential
      signInWithPhoneNumber$1
      startEnrollPhoneMfa
      startSignInPhoneMfa
      utcTimestampToDateString
      verifyPhoneNumberForExisting

      + _processCredentialSavingMfaContextIfNecessary
      + _signInWithCredential
      + signInWithCredential

      classes

      18 dependencies

      AuthCredential
      AuthImpl
      AuthInterop
      AuthMiddlewareQueue
      ConfirmationResultImpl
      Delay
      FetchProvider
      InMemoryPersistence
      NetworkTimeout
      PasswordPolicyImpl
      PersistenceUserManager
      PhoneAuthCredential
      ProactiveRefresh
      StsTokenManager
      Subscription
      UserCredentialImpl
      UserImpl
      UserMetadata

      19 dependencies

      AuthCredential
      AuthImpl
      AuthInterop
      AuthMiddlewareQueue
      ConfirmationResultImpl
      Delay
      FetchProvider
      InMemoryPersistence
      MultiFactorError
      NetworkTimeout
      PasswordPolicyImpl
      PersistenceUserManager
      PhoneAuthCredential
      ProactiveRefresh
      StsTokenManager
      Subscription
      UserCredentialImpl
      UserImpl
      UserMetadata

      + MultiFactorError

    • reauthenticateWithPhoneNumber

      Size

      TypeBase (43e402f)Merge (03c6862)Diff
      size41.7 kB43.0 kB+1.29 kB (+3.1%)
      size-with-ext-deps62.5 kB63.8 kB+1.30 kB (+2.1%)

      Dependency

      TypeBase (43e402f)Merge (03c6862)Diff
      functions

      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
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _processCredentialSavingMfaContextIfNecessary
      _prodErrorMap
      _reauthenticate
      _reloadWithoutSaving
      _tokenExpiresIn
      _verifyPhoneNumber
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getVersionForPlatform
      isUserInvalidated
      linkWithPhoneNumber$1
      mergeProviderData
      providerIdForResponse
      reauthenticateWithCredential
      reauthenticateWithPhoneNumber
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      sendPhoneVerificationCode
      signInWithPhoneNumber$1
      startEnrollPhoneMfa
      startSignInPhoneMfa
      utcTimestampToDateString
      verifyPhoneNumberForExisting

      66 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
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _processCredentialSavingMfaContextIfNecessary
      _prodErrorMap
      _reauthenticate
      _reloadWithoutSaving
      _signInWithCredential
      _tokenExpiresIn
      _verifyPhoneNumber
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getVersionForPlatform
      isUserInvalidated
      linkWithPhoneNumber$1
      mergeProviderData
      providerIdForResponse
      reauthenticateWithCredential
      reauthenticateWithPhoneNumber
      registerAuth
      reload
      requestStsToken
      secondsStringToMilliseconds
      sendPhoneVerificationCode
      signInWithCredential
      signInWithPhoneNumber$1
      startEnrollPhoneMfa
      startSignInPhoneMfa
      utcTimestampToDateString
      verifyPhoneNumberForExisting

      + _signInWithCredential
      + signInWithCredential

    • signInWithPhoneNumber

      Size

      TypeBase (43e402f)Merge (03c6862)Diff
      size41.5 kB42.6 kB+1.16 kB (+2.8%)
      size-with-ext-deps62.3 kB63.4 kB+1.16 kB (+1.9%)

Test Logs

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

@AngelAngelXie AngelAngelXie changed the title Implementing ConfirmWithWebOTP Method[Complete Changes] [Complete Changes]Implementing ConfirmWithWebOTP Method Aug 2, 2023
Copy link
Contributor

@prameshj prameshj left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!

phoneOptions: PhoneInfoOptions | string,
applicationVerifier: ApplicationVerifier,
webOTPTimeout?: number
): Promise<unknown> {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can we explore if "Promise<UserCredential| string>" will work?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. This would also work :) I like that it is more specific than using "unknown" - even though this will not be public for developers to see. I have replaced "unknown" in the return types. Please feel free to comment if you believe "unknown" is preferred.

use(chaiAsPromised);
use(sinonChai);

//interfaces added to provide typescript support for webopt autofill
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this needed in the test fil?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I believe this is needed for us to use OTPCredential in the unit tests. It can be removed once typescript support is added for the WebOTP API.

@AngelAngelXie AngelAngelXie changed the base branch from master to WebOTP August 8, 2023 17:25
@AngelAngelXie AngelAngelXie changed the title [Complete Changes]Implementing ConfirmWithWebOTP Method [With interface workaround] Auth Web OTP Retrieval Aug 11, 2023
Copy link

@renkelvin renkelvin left a comment

Choose a reason for hiding this comment

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

Great, thanks!

@renkelvin renkelvin merged commit cb2aa98 into WebOTP Aug 11, 2023
@renkelvin renkelvin deleted the DewayneTest3 branch August 11, 2023 19:09
@firebase firebase locked and limited conversation to collaborators Sep 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants