Skip to content

Big refactor of reauth / link + basic idp tasks #3242

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

Merged
merged 3 commits into from
Jun 24, 2020

Conversation

sam-gc
Copy link
Contributor

@sam-gc sam-gc commented Jun 19, 2020

No description provided.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jun 19, 2020

Binary Size Report

Affected SDKs

  • firebase

    Click to show 12 binary size changes.
    Type Base (a575f2d) Head (d6c0c83) Diff
    firebase-analytics.js 26.5 kB 26.5 kB -2 B (-0.0%)
    firebase-auth.js 173 kB 173 kB +14 B (+0.0%)
    firebase-database.js 186 kB 186 kB -2 B (-0.0%)
    firebase-firestore.js 288 kB 288 kB +9 B (+0.0%)
    firebase-firestore.memory.js 230 kB 230 kB +9 B (+0.0%)
    firebase-functions.js 9.60 kB 9.60 kB -2 B (-0.0%)
    firebase-installations.js 19.2 kB 19.2 kB -2 B (-0.0%)
    firebase-messaging.js 39.1 kB 39.1 kB -2 B (-0.0%)
    firebase-performance.js 38.3 kB 38.3 kB -2 B (-0.0%)
    firebase-remote-config.js 36.9 kB 36.9 kB -2 B (-0.0%)
    firebase-storage.js 40.8 kB 40.8 kB -2 B (-0.0%)
    firebase.js 821 kB 821 kB +2 B (+0.0%)

Test Logs

};
}

export async function _signIn(params: IdpTaskParams): Promise<UserCredential> {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: _signInWithIdp

@@ -46,4 +48,10 @@ export class UserCredentialImpl implements UserCredential {
// updateAdditionalUserInfoFromIdTokenResponse(userCred, idTokenResponse);
return userCred;
}

static async _forOperation(user: User, operationType: externs.OperationType, response: PhoneOrOauthTokenResponse): Promise<UserCredentialImpl> {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we also use this for SIGN_IN?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me clean this up in a separate PR. The credential param in _fromIdTokenResponse shouldn't be set as the credential field in the UserCredential object. Instead, it is just used to determine "isAnonymous". I will consolidate all of this into one method later

const response = await signInWithIdp(auth, request);

const credential = _authCredentialFromTokenResponse(response);
const userCredential = await UserCredentialImpl._fromIdTokenResponse(
Copy link
Contributor

Choose a reason for hiding this comment

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

why not use _forOperation here? then you can fold the logic for _authCredentialFromTokenResponse and only have it used in one place

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One thing too is that _forOperation doesn't init a user object, which we do need for sign in.

@avolkovi avolkovi assigned sam-gc and unassigned avolkovi Jun 24, 2020
@sam-gc sam-gc closed this Jun 24, 2020
@sam-gc sam-gc reopened this Jun 24, 2020
@sam-gc
Copy link
Contributor Author

sam-gc commented Jun 24, 2020

Didn't mean to close it -_-

@sam-gc sam-gc merged commit e0ebe86 into auth-next Jun 24, 2020
@sam-gc sam-gc deleted the samgho/reafactor-plus-idp branch June 24, 2020 17:50
avolkovi pushed a commit that referenced this pull request Jul 8, 2020
* Big refactor of reauth / link + basic idp tasks

* PR feedback

* Formatting
@firebase firebase locked and limited conversation to collaborators Jul 25, 2020
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.

3 participants