Skip to content

Add App Check token to Auth requests #6982

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 6 commits into from
Feb 1, 2023
Merged

Conversation

lisajian
Copy link
Contributor

@lisajian lisajian commented Jan 26, 2023

Discussion

Includes App Check token in Auth header requests to backend, if present. Passes App Check token to widget via the URL fragment

As part of go/auth-app-check-sdk
Internal bug link: b/265453815

Testing

yarn test passes in packages/auth and packages/auth-compat

API Changes

N/A

@changeset-bot
Copy link

changeset-bot bot commented Jan 26, 2023

🦋 Changeset detected

Latest commit: 968629d

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 Minor
@firebase/auth-compat Minor
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

@lisajian lisajian force-pushed the lj-fac-auth branch 2 times, most recently from 8881085 to 2bb8b1e Compare January 26, 2023 00:10
@lisajian lisajian marked this pull request as ready for review January 26, 2023 00:30
@lisajian lisajian requested a review from rosalyntan January 26, 2023 00:30
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jan 26, 2023

Size Report 1

Affected Products

  • @firebase/auth

    TypeBase (0bab0b7)Merge (3bea516)Diff
    browser156 kB158 kB+1.13 kB (+0.7%)
    cordova184 kB186 kB+1.65 kB (+0.9%)
    esm5205 kB206 kB+1.74 kB (+0.9%)
    main148 kB150 kB+1.14 kB (+0.8%)
    module156 kB158 kB+1.13 kB (+0.7%)
    react-native168 kB169 kB+1.15 kB (+0.7%)
  • @firebase/auth/cordova

    TypeBase (0bab0b7)Merge (3bea516)Diff
    browser184 kB186 kB+1.65 kB (+0.9%)
    module184 kB186 kB+1.65 kB (+0.9%)
  • @firebase/auth/internal

    TypeBase (0bab0b7)Merge (3bea516)Diff
    browser167 kB168 kB+1.13 kB (+0.7%)
    esm5218 kB220 kB+1.74 kB (+0.8%)
    main184 kB186 kB+1.70 kB (+0.9%)
    module167 kB168 kB+1.13 kB (+0.7%)
  • @firebase/auth/react-native

    TypeBase (0bab0b7)Merge (3bea516)Diff
    browser168 kB169 kB+1.15 kB (+0.7%)
    module168 kB169 kB+1.15 kB (+0.7%)
  • bundle

    TypeBase (0bab0b7)Merge (3bea516)Diff
    auth (Anonymous)67.4 kB67.9 kB+498 B (+0.7%)
    auth (EmailAndPassword)71.5 kB72.0 kB+498 B (+0.7%)
    auth (GoogleFBTwitterGitHubPopup)93.9 kB94.5 kB+668 B (+0.7%)
    auth (GooglePopup)91.1 kB91.8 kB+668 B (+0.7%)
    auth (GoogleRedirect)91.4 kB92.0 kB+668 B (+0.7%)
    auth (Phone)77.6 kB78.1 kB+498 B (+0.6%)
  • firebase

    TypeBase (0bab0b7)Merge (3bea516)Diff
    firebase-auth-compat.js126 kB126 kB+579 B (+0.5%)
    firebase-auth-cordova.js138 kB139 kB+956 B (+0.7%)
    firebase-auth-react-native.js150 kB150 kB+745 B (+0.5%)
    firebase-auth.js117 kB118 kB+603 B (+0.5%)
    firebase-compat.js747 kB748 kB+569 B (+0.1%)

Test Logs

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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jan 26, 2023

Size Analysis Report 1

This report is too large (229,775 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

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

@lisajian lisajian changed the title Add App Check token to headers of Auth requests Add App Check token to Auth requests Jan 26, 2023
@lisajian lisajian requested a review from prameshj January 27, 2023 00:12
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.

Generally LGTM pending some comments

config
);
_initializeAuthInstance(authInstance, deps);
_assert(
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we getting rid of the anon function here? I think we copied this from Firestore originally (not exactly sure why it's done this way)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeahh, I wasn't sure why we had the anon function either and didn't notice a difference in behavior with / without it? I think Firestore currently doesn't use an anon function:

const firestoreInstance = new Firestore(

Will leave this open if other folks have an opinion about it

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to remove the anon function if we did not observe any behavior change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool cool

@sam-gc
Copy link
Contributor

sam-gc commented Jan 27, 2023

I also added @prameshj to give her a chance to double check things

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 looping me in! Mostly LGTM, one question about _openRedirect test case.

@lisajian lisajian merged commit 48f6158 into lj-appcheck-feature Feb 1, 2023
@lisajian lisajian deleted the lj-fac-auth branch February 1, 2023 00:55
lisajian added a commit that referenced this pull request Feb 1, 2023
* Add App Check token to headers of Auth requests

* Add App Check token to widget url fragment
@prameshj
Copy link
Contributor

prameshj commented Feb 6, 2023

@renkelvin

lisajian added a commit that referenced this pull request Mar 1, 2023
* Add App Check token to headers of Auth requests

* Add App Check token to widget url fragment
@firebase firebase locked and limited conversation to collaborators Mar 3, 2023
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.

5 participants