Skip to content

Fix AuthError incoherent structure. #5600

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

Closed
wants to merge 3 commits into from
Closed

Fix AuthError incoherent structure. #5600

wants to merge 3 commits into from

Conversation

PabloLION
Copy link
Contributor

Add a AuthErrorData interface for customData in FirebaseError
Change tenantid to tenantId, other tenantId are formatted like this, better than smallcase since ID is a "word"

Discussion

this closes #5599

More TODOs

Testing

I don't know how to test for this specific issue.

API Changes

NONE

Add a AuthErrorData interface for customData in `FirebaseError`
Change tenantid to tenantId, other tenantId are formatted like this, better than smallcase since ID is a "word"
@changeset-bot
Copy link

changeset-bot bot commented Oct 10, 2021

⚠️ No Changeset found

Latest commit: a17629f

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-cla
Copy link

google-cla bot commented Oct 10, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Oct 10, 2021
@PabloLION
Copy link
Contributor Author

@googlebot I signed it!

Copy link
Contributor

@sam-gc sam-gc 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 sending this! The PR looks good, but instead of creating a new named interface for error.customData, we'd like to have that field type inlined

@sam-gc sam-gc assigned PabloLION and unassigned sam-gc Oct 11, 2021
In this way `extends Record<string, string | undefined>` is discarded.
@PabloLION
Copy link
Contributor Author

PabloLION commented Oct 12, 2021

Hi, @sam-gc
I made a new commit but in this way I cannot assert with extends Record<string, string | undefined>.(I don't know why I wanted this before, seems useless).
I read some stack overflow and official document, and now reckon that it is not possible, is it?
I'd be more than grateful if you could correct me.

---- update
For me, the extends is does the same job like & in a different context. But writing oldAuthErrorData & Record<string, string | undefined> seems meaningless to me.

Copy link
Contributor

@sam-gc sam-gc left a comment

Choose a reason for hiding this comment

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

Please run yarn build in the packages/auth directory -- I believe there will be a generated file change that will change that needs to be checked in as well

@sam-gc
Copy link
Contributor

sam-gc commented Oct 12, 2021

@Pablion I'm not sure I quite follow the issue you're describing, but if it builds and tests pass then this is what we want

@PabloLION PabloLION requested a review from sam-gc October 12, 2021 22:09
@PabloLION
Copy link
Contributor Author

I see what's going on here, we have an

export declare interface MultiFactorError extends AuthError {}

So all the related MultiFactorError are changed. I will do yarn test later, and try to fix this.

@PabloLION PabloLION closed this Oct 12, 2021
@PabloLION PabloLION deleted the patch-1 branch October 12, 2021 22:15
@PabloLION PabloLION restored the patch-1 branch October 12, 2021 22:15
@PabloLION PabloLION reopened this Oct 12, 2021
@sam-gc
Copy link
Contributor

sam-gc commented Oct 13, 2021

Okay so I dug into this a bit more and it looks like there's going to have to be a deep-ish refactor of the multi-factor code to make this work. @Pablion would you please change the base to https://github.com/firebase/firebase-js-sdk/tree/auth_error_type_fix ? We can go ahead and merge the type changes that you've done in this PR, and after that I'll go ahead and make the necessary refactors/fixes before opening a new PR to merge into Master. I'll CC you on that final PR 👍

@PabloLION
Copy link
Contributor Author

@sam-gc I tried to fix the MFA error last night and found it quite complex. I'll do what you said now.

@PabloLION PabloLION closed this Oct 13, 2021
@sam-gc
Copy link
Contributor

sam-gc commented Oct 13, 2021

@Pablion I believe you can use this same PR, you just need to edit the base by clicking the edit button at top-right. If that doesn't work though, no big deal you can open a new PR

@PabloLION PabloLION mentioned this pull request Oct 13, 2021
1 task
@PabloLION
Copy link
Contributor Author

@sam-gc I closed this PR because I want to change the branch name, also thinking a new PR would make things clearer.

@firebase firebase locked and limited conversation to collaborators Nov 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incoherent data structure on AuthError
2 participants