-
Notifications
You must be signed in to change notification settings - Fork 938
Add App Check token to FirebaseServerApp #8651
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
Changes from 11 commits
25f264f
b971b89
7c8ec93
de89ecd
e632eeb
1e511b5
ad17dab
33e4889
02708d3
c1a1322
34372c4
a5075a2
a218674
e6b6625
9da69bc
9a1299b
b3a1c4f
037041f
d6e1917
4fc151f
302e1dc
61ec38d
0526b87
c444e66
3352b7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
'@firebase/app': minor | ||
'firebase': minor | ||
'@firebase/data-connect': patch | ||
'@firebase/firestore': patch | ||
'@firebase/functions': patch | ||
'@firebase/database': patch | ||
'@firebase/vertexai': patch | ||
'@firebase/storage': patch | ||
'@firebase/auth': patch | ||
--- | ||
|
||
FirebaseServerApp may now be initalized with an App Check which will be used by SDKs in lieu of initializing an instance of App Check to get the current token. This should unblock the use of App Check enforced products in SSR environments. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -196,6 +196,12 @@ export interface FirebaseServerAppSettings | |
*/ | ||
authIdToken?: string; | ||
|
||
/** | ||
* An optional App Check token. If provided, the Firebase SDKs that use App Check will utilizze | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo "utilize." Personally I like in lieu, but I'll bet good money our style guide advises something more like "instead of" or "in place of." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed! I went with "in place of". |
||
* this App Check token in lieu of requiring an instance of App Check to be initialized. | ||
*/ | ||
appCheckToken?: string; | ||
|
||
/** | ||
* An optional object. If provided, the Firebase SDK uses a `FinalizationRegistry` | ||
* object to monitor the garbage collection status of the provided object. The | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,37 +166,6 @@ describe('Integration test: Auth FirebaseServerApp tests', () => { | |
await deleteApp(serverApp); | ||
}); | ||
|
||
it('invalid token does not sign in user', async () => { | ||
if (isBrowser()) { | ||
return; | ||
} | ||
const authIdToken = '{ invalid token }'; | ||
const firebaseServerAppSettings = { authIdToken }; | ||
|
||
const serverApp = initializeServerApp( | ||
getAppConfig(), | ||
firebaseServerAppSettings | ||
); | ||
const serverAppAuth = getTestInstanceForServerApp(serverApp); | ||
expect(serverAppAuth.currentUser).to.be.null; | ||
|
||
let numberServerLogins = 0; | ||
onAuthStateChanged(serverAppAuth, serverAuthUser => { | ||
if (serverAuthUser) { | ||
numberServerLogins++; | ||
} | ||
}); | ||
|
||
await new Promise(resolve => { | ||
setTimeout(resolve, signInWaitDuration); | ||
}); | ||
|
||
expect(numberServerLogins).to.equal(0); | ||
expect(serverAppAuth.currentUser).to.be.null; | ||
|
||
await deleteApp(serverApp); | ||
}); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Invalid tokens are now handled by a new flow, which we test in |
||
it('signs in with email credentials user', async () => { | ||
if (isBrowser()) { | ||
return; | ||
|
Uh oh!
There was an error while loading. Please reload this page.