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

[Auth] Fix error typing and bring MFA error into alignment with the current API standard #5616

Merged
merged 6 commits into from
Oct 19, 2021

Conversation

sam-gc
Copy link
Contributor

@sam-gc sam-gc commented Oct 14, 2021

Specifically, MultiFactorError was putting fields on the error itself instead of error.customData. The main AuthError was doing the right thing in the code, but the public typing was wrong. With this PR both the typing and the implementation should be consistent using the new API standard (by putting everything on error.customData). Thanks @Pablion for catching the issue. The reference docs will update automatically with this PR.

PabloLION and others added 2 commits October 14, 2021 09:19
* fix interface AuthError

change interface AuthError to correct structure

* remove `declare`
@changeset-bot
Copy link

changeset-bot bot commented Oct 14, 2021

🦋 Changeset detected

Latest commit: b4ae127

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-cla google-cla bot added the cla: yes label Oct 14, 2021
@sam-gc sam-gc requested a review from egilmorez as a code owner October 14, 2021 16:54
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Oct 14, 2021

Binary Size Report

Affected SDKs

  • @firebase/auth/cordova

    Type Base (703ef77) Head (3da0d9a) Diff
    browser 178 kB 179 kB +132 B (+0.1%)
    module 178 kB 179 kB +132 B (+0.1%)
  • @firebase/auth/internal

    Type Base (703ef77) Head (3da0d9a) Diff
    browser 163 kB 163 kB +144 B (+0.1%)
    esm5 211 kB 211 kB +153 B (+0.1%)
    main 178 kB 178 kB +132 B (+0.1%)
    module 163 kB 163 kB +144 B (+0.1%)
  • @firebase/auth/react-native

    Type Base (703ef77) Head (3da0d9a) Diff
    browser 143 kB 143 kB +22 B (+0.0%)
    module 143 kB 143 kB +22 B (+0.0%)
  • @firebase/firestore

    Type Base (703ef77) Head (3da0d9a) Diff
    browser 225 kB 225 kB +253 B (+0.1%)
    esm5 282 kB 282 kB +273 B (+0.1%)
    main 512 kB 423 kB -89.4 kB (-17.4%)
    module 225 kB 225 kB +253 B (+0.1%)
    react-native 225 kB 225 kB +253 B (+0.1%)
  • @firebase/firestore-lite

    Type Base (703ef77) Head (3da0d9a) Diff
    main 147 kB 123 kB -23.8 kB (-16.1%)
  • firebase

    Type Base (703ef77) Head (3da0d9a) Diff
    firebase-auth-compat.js 122 kB 122 kB +37 B (+0.0%)
    firebase-auth-cordova.js 459 kB 460 kB +399 B (+0.1%)
    firebase-auth-react-native.js 430 kB 430 kB +43 B (+0.0%)
    firebase-auth.js 409 kB 410 kB +311 B (+0.1%)
    firebase-compat.js 749 kB 749 kB +288 B (+0.0%)
    firebase-firestore-compat.js 277 kB 277 kB +251 B (+0.1%)
    firebase-firestore.js 762 kB 763 kB +792 B (+0.1%)

Test Logs

@google-oss-bot google-oss-bot added the doc-changes PRs that affect docs label Oct 14, 2021
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Oct 14, 2021

Size Analysis Report

Affected Products

  • @firebase/auth

    • EmailAuthCredential

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      31.9 kB
      31.9 kB
      +1 B (+0.0%)
      size-with-ext-deps
      43.8 kB
      43.8 kB
      +1 B (+0.0%)
    • EmailAuthProvider

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      33.3 kB
      33.3 kB
      +1 B (+0.0%)
      size-with-ext-deps
      45.5 kB
      45.5 kB
      +1 B (+0.0%)
    • FacebookAuthProvider

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      34.9 kB
      34.9 kB
      +1 B (+0.0%)
      size-with-ext-deps
      46.8 kB
      46.8 kB
      +1 B (+0.0%)
    • GithubAuthProvider

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      34.9 kB
      34.9 kB
      +1 B (+0.0%)
      size-with-ext-deps
      46.8 kB
      46.8 kB
      +1 B (+0.0%)
    • GoogleAuthProvider

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      34.9 kB
      34.9 kB
      +1 B (+0.0%)
      size-with-ext-deps
      46.8 kB
      46.8 kB
      +1 B (+0.0%)
    • OAuthCredential

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      32.0 kB
      32.0 kB
      +1 B (+0.0%)
      size-with-ext-deps
      43.9 kB
      43.9 kB
      +1 B (+0.0%)
    • OAuthProvider

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      35.9 kB
      35.9 kB
      +1 B (+0.0%)
      size-with-ext-deps
      47.7 kB
      47.7 kB
      +1 B (+0.0%)
    • PhoneAuthCredential

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      32.0 kB
      32.0 kB
      +1 B (+0.0%)
      size-with-ext-deps
      43.9 kB
      43.9 kB
      +1 B (+0.0%)
    • PhoneAuthProvider

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      33.7 kB
      33.7 kB
      +1 B (+0.0%)
      size-with-ext-deps
      45.6 kB
      45.6 kB
      +1 B (+0.0%)
    • SAMLAuthProvider

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      36.2 kB
      36.2 kB
      +1 B (+0.0%)
      size-with-ext-deps
      48.1 kB
      48.1 kB
      +1 B (+0.0%)
    • TwitterAuthProvider

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      34.9 kB
      34.9 kB
      +1 B (+0.0%)
      size-with-ext-deps
      46.8 kB
      46.8 kB
      +1 B (+0.0%)
    • createUserWithEmailAndPassword

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      30.9 kB
      30.9 kB
      +1 B (+0.0%)
      size-with-ext-deps
      42.8 kB
      42.8 kB
      +1 B (+0.0%)
    • getAuth

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      61.5 kB
      61.6 kB
      +79 B (+0.1%)
      size-with-ext-deps
      74.0 kB
      74.1 kB
      +79 B (+0.1%)
    • getMultiFactorResolver

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      32.5 kB
      32.5 kB
      -30 B (-0.1%)
      size-with-ext-deps
      44.4 kB
      44.4 kB
      -30 B (-0.1%)
    • getRedirectResult

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      37.3 kB
      37.4 kB
      +58 B (+0.2%)
      size-with-ext-deps
      49.2 kB
      49.3 kB
      +58 B (+0.1%)
    • linkWithPhoneNumber

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      34.5 kB
      34.5 kB
      +1 B (+0.0%)
      size-with-ext-deps
      46.3 kB
      46.4 kB
      +1 B (+0.0%)
    • linkWithPopup

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      41.0 kB
      41.0 kB
      -21 B (-0.1%)
      size-with-ext-deps
      52.9 kB
      52.9 kB
      -21 B (-0.0%)
    • linkWithRedirect

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      36.2 kB
      36.2 kB
      +1 B (+0.0%)
      size-with-ext-deps
      48.1 kB
      48.1 kB
      +1 B (+0.0%)
    • reauthenticateWithCredential

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      31.4 kB
      31.4 kB
      -22 B (-0.1%)
      size-with-ext-deps
      43.2 kB
      43.2 kB
      -22 B (-0.1%)
    • reauthenticateWithPhoneNumber

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      35.0 kB
      35.0 kB
      -21 B (-0.1%)
      size-with-ext-deps
      46.9 kB
      46.9 kB
      -21 B (-0.0%)
    • reauthenticateWithPopup

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      41.0 kB
      41.0 kB
      -21 B (-0.1%)
      size-with-ext-deps
      52.9 kB
      52.9 kB
      -21 B (-0.0%)
    • reauthenticateWithRedirect

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      35.9 kB
      35.9 kB
      +1 B (+0.0%)
      size-with-ext-deps
      47.8 kB
      47.8 kB
      +1 B (+0.0%)
    • signInAnonymously

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      31.0 kB
      31.0 kB
      +1 B (+0.0%)
      size-with-ext-deps
      42.9 kB
      42.9 kB
      +1 B (+0.0%)
    • signInWithCredential

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      31.2 kB
      31.1 kB
      -22 B (-0.1%)
      size-with-ext-deps
      43.0 kB
      43.0 kB
      -22 B (-0.1%)
    • signInWithCustomToken

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      30.9 kB
      30.9 kB
      +1 B (+0.0%)
      size-with-ext-deps
      42.8 kB
      42.8 kB
      +1 B (+0.0%)
    • signInWithEmailAndPassword

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      34.8 kB
      34.8 kB
      -21 B (-0.1%)
      size-with-ext-deps
      46.9 kB
      46.9 kB
      -21 B (-0.0%)
    • signInWithEmailLink

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      35.0 kB
      35.0 kB
      -21 B (-0.1%)
      size-with-ext-deps
      47.1 kB
      47.1 kB
      -21 B (-0.0%)
    • signInWithPhoneNumber

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      34.8 kB
      34.8 kB
      -21 B (-0.1%)
      size-with-ext-deps
      46.7 kB
      46.7 kB
      -21 B (-0.0%)
    • signInWithPopup

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      41.0 kB
      41.0 kB
      -21 B (-0.1%)
      size-with-ext-deps
      52.9 kB
      52.9 kB
      -21 B (-0.0%)
    • signInWithRedirect

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      35.6 kB
      35.6 kB
      +1 B (+0.0%)
      size-with-ext-deps
      47.5 kB
      47.5 kB
      +1 B (+0.0%)
    • browserPopupRedirectResolver

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      53.8 kB
      53.9 kB
      +79 B (+0.1%)
      size-with-ext-deps
      65.9 kB
      65.9 kB
      +79 B (+0.1%)
  • @firebase/firestore

    • addDoc

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      103 kB
      103 kB
      +230 B (+0.2%)
      size-with-ext-deps
      152 kB
      152 kB
      +230 B (+0.2%)
    • deleteDoc

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      94.3 kB
      94.5 kB
      +230 B (+0.2%)
      size-with-ext-deps
      143 kB
      143 kB
      +230 B (+0.2%)
    • enableIndexedDbPersistence

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      139 kB
      139 kB
      +230 B (+0.2%)
      size-with-ext-deps
      188 kB
      188 kB
      +230 B (+0.1%)
    • enableMultiTabIndexedDbPersistence

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      170 kB
      171 kB
      +253 B (+0.1%)
      size-with-ext-deps
      220 kB
      220 kB
      +253 B (+0.1%)
    • executeWrite

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      93.4 kB
      93.7 kB
      +230 B (+0.2%)
      size-with-ext-deps
      142 kB
      142 kB
      +230 B (+0.2%)
    • getDoc

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      119 kB
      119 kB
      +230 B (+0.2%)
      size-with-ext-deps
      168 kB
      168 kB
      +230 B (+0.1%)
    • getDocFromServer

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      119 kB
      119 kB
      +230 B (+0.2%)
      size-with-ext-deps
      168 kB
      168 kB
      +230 B (+0.1%)
    • getDocs

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      121 kB
      121 kB
      +230 B (+0.2%)
      size-with-ext-deps
      169 kB
      170 kB
      +230 B (+0.1%)
    • getDocsFromServer

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      121 kB
      121 kB
      +230 B (+0.2%)
      size-with-ext-deps
      169 kB
      169 kB
      +230 B (+0.1%)
    • onSnapshot

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      121 kB
      121 kB
      +230 B (+0.2%)
      size-with-ext-deps
      170 kB
      170 kB
      +230 B (+0.1%)
    • onSnapshotsInSync

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      111 kB
      111 kB
      +230 B (+0.2%)
      size-with-ext-deps
      160 kB
      160 kB
      +230 B (+0.1%)
    • setDoc

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      102 kB
      103 kB
      +230 B (+0.2%)
      size-with-ext-deps
      151 kB
      151 kB
      +230 B (+0.2%)
    • updateDoc

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      103 kB
      103 kB
      +230 B (+0.2%)
      size-with-ext-deps
      152 kB
      152 kB
      +230 B (+0.2%)
    • writeBatch

      Size Table

      TypeBase (703ef77)Head (3da0d9a)Diff
      size
      105 kB
      105 kB
      +230 B (+0.2%)
      size-with-ext-deps
      154 kB
      154 kB
      +230 B (+0.1%)

Copy link
Contributor

@lisajian lisajian left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple nits

@sam-gc
Copy link
Contributor Author

sam-gc commented Oct 14, 2021

Adding @Feiyang1 and @hsubox76 for approval for changes to api reivew

packages/auth/src/model/public_types.ts Outdated Show resolved Hide resolved
packages/auth/src/model/public_types.ts Outdated Show resolved Hide resolved
packages/auth/src/model/public_types.ts Outdated Show resolved Hide resolved
packages/auth/src/model/public_types.ts Outdated Show resolved Hide resolved
packages/auth/src/model/public_types.ts Outdated Show resolved Hide resolved
packages/auth/src/model/public_types.ts Outdated Show resolved Hide resolved
packages/auth/src/model/public_types.ts Outdated Show resolved Hide resolved
@PabloLION
Copy link
Contributor

Comment in English is not my advantage, I prefer the new comments.
And dont forget to close #5599 after this please.

Co-authored-by: Kevin Cheung <kevinthecheung@users.noreply.github.com>
.changeset/fresh-ways-think.md Show resolved Hide resolved
@sam-gc sam-gc merged commit 69ff8eb into master Oct 19, 2021
@sam-gc sam-gc deleted the auth_error_type_fix branch October 19, 2021 19:38
@PabloLION
Copy link
Contributor

PabloLION commented Oct 19, 2021

@sam-gc Thank for fixting this! I think this closes #5599. Please confirm.
By the way, the document I mentioned there seems not fixed? Should I create a new issue?

Also this part seems to be outdated(v8 SDK yet shown up in a v9 page)
like auth.signInWithPopup(OAuthprovider) should be signInWithPopup(authInstance,OAuthProvider), so should auth.signInWithEmailAndPassword(email, password) (first arg: auth instance)... etc.

This was referenced Oct 19, 2021
@firebase firebase locked and limited conversation to collaborators Nov 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes doc-changes PRs that affect docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants