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

Fix proactive refresh logic, add some tests #6544

Merged
merged 2 commits into from
Aug 19, 2022
Merged

Fix proactive refresh logic, add some tests #6544

merged 2 commits into from
Aug 19, 2022

Conversation

sam-gc
Copy link
Contributor

@sam-gc sam-gc commented Aug 18, 2022

We noticed the logic in the proactive refresh code was not quite correct (it wasn't turning on for newly-signed-in users). Turns out we also never tested this. D'oh! I've added some tests and walked through the code with Maneesh and I think this puts us in a better spot.

@changeset-bot
Copy link

changeset-bot bot commented Aug 18, 2022

🦋 Changeset detected

Latest commit: 437c652

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

@sam-gc sam-gc requested a review from egilmorez as a code owner August 18, 2022 17:58
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Aug 18, 2022

Size Report 1

Affected Products

  • @firebase/auth

    TypeBase (9f1e3c6)Merge (c96e631)Diff
    browser155 kB155 kB-1 B (-0.0%)
    cordova183 kB183 kB-1 B (-0.0%)
    esm5203 kB203 kB-1 B (-0.0%)
    main148 kB148 kB-1 B (-0.0%)
    module155 kB155 kB-1 B (-0.0%)
    react-native168 kB168 kB-1 B (-0.0%)
  • @firebase/auth/cordova

    TypeBase (9f1e3c6)Merge (c96e631)Diff
    browser183 kB183 kB-1 B (-0.0%)
    module183 kB183 kB-1 B (-0.0%)
  • @firebase/auth/internal

    TypeBase (9f1e3c6)Merge (c96e631)Diff
    browser166 kB166 kB-1 B (-0.0%)
    esm5216 kB216 kB-1 B (-0.0%)
    main184 kB184 kB-1 B (-0.0%)
    module166 kB166 kB-1 B (-0.0%)
  • @firebase/auth/react-native

    TypeBase (9f1e3c6)Merge (c96e631)Diff
    browser168 kB168 kB-1 B (-0.0%)
    module168 kB168 kB-1 B (-0.0%)
  • bundle

    TypeBase (9f1e3c6)Merge (c96e631)Diff
    auth (Anonymous)66.4 kB66.4 kB-1 B (-0.0%)
    auth (EmailAndPassword)70.5 kB70.5 kB-1 B (-0.0%)
    auth (GoogleFBTwitterGitHubPopup)90.4 kB90.4 kB-1 B (-0.0%)
    auth (GooglePopup)90.1 kB90.1 kB-1 B (-0.0%)
    auth (GoogleRedirect)90.3 kB90.3 kB-1 B (-0.0%)
    auth (Phone)76.6 kB76.6 kB-1 B (-0.0%)
  • firebase

    TypeBase (9f1e3c6)Merge (c96e631)Diff
    firebase-auth-compat.js125 kB125 kB-2 B (-0.0%)
    firebase-auth-cordova.js137 kB137 kB-2 B (-0.0%)
    firebase-auth-react-native.js148 kB148 kB-2 B (-0.0%)
    firebase-auth.js116 kB116 kB-2 B (-0.0%)
    firebase-compat.js794 kB794 kB-2 B (-0.0%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/xBMQwlIefc.html
Copy link
Contributor

@maneesht maneesht left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for doing this!

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Aug 18, 2022

Size Analysis Report 1

Affected Products

  • @firebase/auth

    • ActionCodeOperation

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.6 kB31.6 kB-1 B (-0.0%)
      size-with-ext-deps51.4 kB51.4 kB-1 B (-0.0%)
    • ActionCodeURL

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.5 kB32.5 kB-1 B (-0.0%)
      size-with-ext-deps52.5 kB52.5 kB-1 B (-0.0%)
    • AuthCredential

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.6 kB31.6 kB-1 B (-0.0%)
      size-with-ext-deps51.4 kB51.4 kB-1 B (-0.0%)
    • AuthErrorCodes

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size36.0 kB36.0 kB-1 B (-0.0%)
      size-with-ext-deps55.8 kB55.8 kB-1 B (-0.0%)
    • EmailAuthCredential

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size33.5 kB33.5 kB-1 B (-0.0%)
      size-with-ext-deps53.3 kB53.3 kB-1 B (-0.0%)
    • EmailAuthProvider

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size35.0 kB35.0 kB-1 B (-0.0%)
      size-with-ext-deps55.0 kB55.0 kB-1 B (-0.0%)
    • FacebookAuthProvider

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size36.6 kB36.6 kB-1 B (-0.0%)
      size-with-ext-deps56.3 kB56.3 kB-1 B (-0.0%)
    • FactorId

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.4 kB31.4 kB-1 B (-0.0%)
      size-with-ext-deps51.2 kB51.2 kB-1 B (-0.0%)
    • GithubAuthProvider

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size36.6 kB36.6 kB-1 B (-0.0%)
      size-with-ext-deps56.3 kB56.3 kB-1 B (-0.0%)
    • GoogleAuthProvider

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size36.6 kB36.6 kB-1 B (-0.0%)
      size-with-ext-deps56.3 kB56.3 kB-1 B (-0.0%)
    • OAuthCredential

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size33.6 kB33.6 kB-1 B (-0.0%)
      size-with-ext-deps53.4 kB53.4 kB-1 B (-0.0%)
    • OAuthProvider

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size37.5 kB37.5 kB-1 B (-0.0%)
      size-with-ext-deps57.3 kB57.3 kB-1 B (-0.0%)
    • OperationType

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.4 kB31.4 kB-1 B (-0.0%)
      size-with-ext-deps51.2 kB51.2 kB-1 B (-0.0%)
    • PhoneAuthCredential

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size33.6 kB33.6 kB-1 B (-0.0%)
      size-with-ext-deps53.4 kB53.4 kB-1 B (-0.0%)
    • PhoneAuthProvider

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size35.3 kB35.3 kB-1 B (-0.0%)
      size-with-ext-deps55.1 kB55.1 kB-1 B (-0.0%)
    • PhoneMultiFactorGenerator

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.4 kB32.4 kB-1 B (-0.0%)
      size-with-ext-deps52.1 kB52.1 kB-1 B (-0.0%)
    • ProviderId

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.5 kB31.5 kB-1 B (-0.0%)
      size-with-ext-deps51.3 kB51.3 kB-1 B (-0.0%)
    • RecaptchaVerifier

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size37.9 kB37.9 kB-1 B (-0.0%)
      size-with-ext-deps57.7 kB57.7 kB-1 B (-0.0%)
    • SAMLAuthProvider

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size37.8 kB37.8 kB-1 B (-0.0%)
      size-with-ext-deps57.6 kB57.6 kB-1 B (-0.0%)
    • SignInMethod

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.5 kB31.5 kB-1 B (-0.0%)
      size-with-ext-deps51.3 kB51.3 kB-1 B (-0.0%)
    • TwitterAuthProvider

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size36.6 kB36.6 kB-1 B (-0.0%)
      size-with-ext-deps56.3 kB56.3 kB-1 B (-0.0%)
    • applyActionCode

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.6 kB31.6 kB-1 B (-0.0%)
      size-with-ext-deps51.4 kB51.4 kB-1 B (-0.0%)
    • beforeAuthStateChanged

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.4 kB31.4 kB-1 B (-0.0%)
      size-with-ext-deps51.2 kB51.2 kB-1 B (-0.0%)
    • browserLocalPersistence

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size34.8 kB34.8 kB-1 B (-0.0%)
      size-with-ext-deps54.7 kB54.7 kB-1 B (-0.0%)
    • browserPopupRedirectResolver

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size55.8 kB55.8 kB-1 B (-0.0%)
      size-with-ext-deps75.8 kB75.8 kB-1 B (-0.0%)
    • browserSessionPersistence

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size34.8 kB34.8 kB-1 B (-0.0%)
      size-with-ext-deps54.7 kB54.7 kB-1 B (-0.0%)
    • checkActionCode

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.6 kB32.6 kB-1 B (-0.0%)
      size-with-ext-deps52.3 kB52.3 kB-1 B (-0.0%)
    • confirmPasswordReset

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.6 kB31.6 kB-1 B (-0.0%)
      size-with-ext-deps51.4 kB51.4 kB-1 B (-0.0%)
    • connectAuthEmulator

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size33.1 kB33.1 kB-1 B (-0.0%)
      size-with-ext-deps52.9 kB52.9 kB-1 B (-0.0%)
    • createUserWithEmailAndPassword

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.5 kB32.5 kB-1 B (-0.0%)
      size-with-ext-deps52.3 kB52.3 kB-1 B (-0.0%)
    • debugErrorMap

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size42.5 kB42.5 kB-1 B (-0.0%)
      size-with-ext-deps62.3 kB62.3 kB-1 B (-0.0%)
    • deleteUser

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.4 kB31.4 kB-1 B (-0.0%)
      size-with-ext-deps51.2 kB51.2 kB-1 B (-0.0%)
    • fetchSignInMethodsForEmail

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.8 kB31.8 kB-1 B (-0.0%)
      size-with-ext-deps51.6 kB51.6 kB-1 B (-0.0%)
    • getAdditionalUserInfo

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.7 kB32.7 kB-1 B (-0.0%)
      size-with-ext-deps52.5 kB52.5 kB-1 B (-0.0%)
    • getAuth

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size63.5 kB63.5 kB-1 B (-0.0%)
      size-with-ext-deps84.1 kB84.1 kB-1 B (-0.0%)
    • getIdToken

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.4 kB31.4 kB-1 B (-0.0%)
      size-with-ext-deps51.2 kB51.2 kB-1 B (-0.0%)
    • getIdTokenResult

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.4 kB31.4 kB-1 B (-0.0%)
      size-with-ext-deps51.1 kB51.1 kB-1 B (-0.0%)
    • getMultiFactorResolver

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size34.1 kB34.1 kB-1 B (-0.0%)
      size-with-ext-deps53.9 kB53.9 kB-1 B (-0.0%)
    • getRedirectResult

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size39.0 kB39.0 kB-1 B (-0.0%)
      size-with-ext-deps58.8 kB58.8 kB-1 B (-0.0%)
    • inMemoryPersistence

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.4 kB31.4 kB-1 B (-0.0%)
      size-with-ext-deps51.1 kB51.1 kB-1 B (-0.0%)
    • indexedDBLocalPersistence

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size38.8 kB38.8 kB-1 B (-0.0%)
      size-with-ext-deps58.6 kB58.6 kB-1 B (-0.0%)
    • initializeAuth

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.6 kB31.6 kB-1 B (-0.0%)
      size-with-ext-deps51.9 kB51.9 kB-1 B (-0.0%)
    • isSignInWithEmailLink

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.6 kB32.6 kB-1 B (-0.0%)
      size-with-ext-deps52.6 kB52.6 kB-1 B (-0.0%)
    • linkWithCredential

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.4 kB32.4 kB-1 B (-0.0%)
      size-with-ext-deps52.2 kB52.2 kB-1 B (-0.0%)
    • linkWithPhoneNumber

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size36.1 kB36.1 kB-1 B (-0.0%)
      size-with-ext-deps55.9 kB55.9 kB-1 B (-0.0%)
    • linkWithPopup

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size42.6 kB42.6 kB-1 B (-0.0%)
      size-with-ext-deps62.4 kB62.4 kB-1 B (-0.0%)
    • linkWithRedirect

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size37.8 kB37.8 kB-1 B (-0.0%)
      size-with-ext-deps57.6 kB57.6 kB-1 B (-0.0%)
    • multiFactor

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size33.6 kB33.6 kB-1 B (-0.0%)
      size-with-ext-deps53.4 kB53.4 kB-1 B (-0.0%)
    • onAuthStateChanged

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.4 kB31.4 kB-1 B (-0.0%)
      size-with-ext-deps51.2 kB51.2 kB-1 B (-0.0%)
    • onIdTokenChanged

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.4 kB31.4 kB-1 B (-0.0%)
      size-with-ext-deps51.2 kB51.2 kB-1 B (-0.0%)
    • parseActionCodeURL

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.5 kB32.5 kB-1 B (-0.0%)
      size-with-ext-deps52.5 kB52.5 kB-1 B (-0.0%)
    • prodErrorMap

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.4 kB31.4 kB-1 B (-0.0%)
      size-with-ext-deps51.1 kB51.1 kB-1 B (-0.0%)
    • reauthenticateWithCredential

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size33.0 kB33.0 kB-1 B (-0.0%)
      size-with-ext-deps52.8 kB52.8 kB-1 B (-0.0%)
    • reauthenticateWithPhoneNumber

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size36.6 kB36.6 kB-1 B (-0.0%)
      size-with-ext-deps56.4 kB56.4 kB-1 B (-0.0%)
    • reauthenticateWithPopup

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size42.6 kB42.6 kB-1 B (-0.0%)
      size-with-ext-deps62.4 kB62.4 kB-1 B (-0.0%)
    • reauthenticateWithRedirect

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size37.6 kB37.6 kB-1 B (-0.0%)
      size-with-ext-deps57.3 kB57.3 kB-1 B (-0.0%)
    • reload

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.4 kB31.4 kB-1 B (-0.0%)
      size-with-ext-deps51.1 kB51.1 kB-1 B (-0.0%)
    • sendEmailVerification

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.4 kB32.4 kB-1 B (-0.0%)
      size-with-ext-deps52.2 kB52.2 kB-1 B (-0.0%)
    • sendPasswordResetEmail

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.3 kB32.3 kB-1 B (-0.0%)
      size-with-ext-deps52.1 kB52.1 kB-1 B (-0.0%)
    • sendSignInLinkToEmail

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.4 kB32.4 kB-1 B (-0.0%)
      size-with-ext-deps52.2 kB52.2 kB-1 B (-0.0%)
    • setPersistence

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.4 kB31.4 kB-1 B (-0.0%)
      size-with-ext-deps51.2 kB51.2 kB-1 B (-0.0%)
    • signInAnonymously

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.7 kB32.7 kB-1 B (-0.0%)
      size-with-ext-deps52.4 kB52.4 kB-1 B (-0.0%)
    • signInWithCredential

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.8 kB32.8 kB-1 B (-0.0%)
      size-with-ext-deps52.5 kB52.5 kB-1 B (-0.0%)
    • signInWithCustomToken

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.5 kB32.5 kB-1 B (-0.0%)
      size-with-ext-deps52.3 kB52.3 kB-1 B (-0.0%)
    • signInWithEmailAndPassword

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size36.4 kB36.4 kB-1 B (-0.0%)
      size-with-ext-deps56.4 kB56.4 kB-1 B (-0.0%)
    • signInWithEmailLink

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size36.6 kB36.6 kB-1 B (-0.0%)
      size-with-ext-deps56.6 kB56.6 kB-1 B (-0.0%)
    • signInWithPhoneNumber

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size36.4 kB36.4 kB-1 B (-0.0%)
      size-with-ext-deps56.2 kB56.2 kB-1 B (-0.0%)
    • signInWithPopup

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size42.6 kB42.6 kB-1 B (-0.0%)
      size-with-ext-deps62.4 kB62.4 kB-1 B (-0.0%)
    • signInWithRedirect

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size37.3 kB37.3 kB-1 B (-0.0%)
      size-with-ext-deps57.1 kB57.1 kB-1 B (-0.0%)
    • signOut

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.4 kB31.4 kB-1 B (-0.0%)
      size-with-ext-deps51.2 kB51.2 kB-1 B (-0.0%)
    • unlink

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.0 kB32.0 kB-1 B (-0.0%)
      size-with-ext-deps51.7 kB51.7 kB-1 B (-0.0%)
    • updateCurrentUser

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.4 kB31.4 kB-1 B (-0.0%)
      size-with-ext-deps51.2 kB51.2 kB-1 B (-0.0%)
    • updateEmail

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.7 kB31.7 kB-1 B (-0.0%)
      size-with-ext-deps51.5 kB51.5 kB-1 B (-0.0%)
    • updatePassword

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.7 kB31.7 kB-1 B (-0.0%)
      size-with-ext-deps51.5 kB51.5 kB-1 B (-0.0%)
    • updatePhoneNumber

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.1 kB32.1 kB-1 B (-0.0%)
      size-with-ext-deps51.9 kB51.9 kB-1 B (-0.0%)
    • updateProfile

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.9 kB31.9 kB-1 B (-0.0%)
      size-with-ext-deps51.7 kB51.7 kB-1 B (-0.0%)
    • useDeviceLanguage

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size31.4 kB31.4 kB-1 B (-0.0%)
      size-with-ext-deps51.2 kB51.2 kB-1 B (-0.0%)
    • verifyBeforeUpdateEmail

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.5 kB32.5 kB-1 B (-0.0%)
      size-with-ext-deps52.2 kB52.2 kB-1 B (-0.0%)
    • verifyPasswordResetCode

      Size

      TypeBase (9f1e3c6)Merge (c7609d1)Diff
      size32.6 kB32.6 kB-1 B (-0.0%)
      size-with-ext-deps52.4 kB52.4 kB-1 B (-0.0%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/rL9s2KqKF3.html
@prameshj
Copy link
Contributor

/lgtm

Thanks for fixing!

@sam-gc sam-gc merged commit bea604e into master Aug 19, 2022
@sam-gc sam-gc deleted the sam-gc/proactive branch August 19, 2022 15:43
@google-oss-bot google-oss-bot mentioned this pull request Aug 31, 2022
@firebase firebase locked and limited conversation to collaborators Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
5 participants