Skip to content

Commit 8faaddc

Browse files
ssbushiavolkovi
authored andcommitted
Add limited token support for functions
1 parent a0bb768 commit 8faaddc

File tree

10 files changed

+5006
-129
lines changed

10 files changed

+5006
-129
lines changed

common/api-review/functions.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export function httpsCallableFromURL<RequestData = unknown, ResponseData = unkno
4444
// @public
4545
export interface HttpsCallableOptions {
4646
timeout?: number;
47+
useLimitedUseAppCheckToken?: boolean;
4748
}
4849

4950
// @public

packages/app-check-interop-types/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export interface FirebaseAppCheckInternal {
2020
// is present. Returns null if no token is present and no token requests are in-flight.
2121
getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>;
2222

23+
// Gets a limited use Firebase App Check token. This method should be used
24+
// only if you need to authorize requests to a non-Firebase backend.
25+
getLimitedUseToken(): Promise<AppCheckTokenResult>;
26+
2327
// Registers a listener to changes in the token state. There can be more than one listener
2428
// registered at the same time for one or more FirebaseAppAttestation instances. The
2529
// listeners call back on the UI thread whenever the current token associated with this

packages/app-check/src/factory.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { FirebaseApp, _FirebaseService } from '@firebase/app';
2020
import { FirebaseAppCheckInternal, ListenerType } from './types';
2121
import {
2222
getToken,
23+
getLimitedUseToken,
2324
addTokenListener,
2425
removeTokenListener
2526
} from './internal-api';
@@ -55,6 +56,7 @@ export function internalFactory(
5556
): FirebaseAppCheckInternal {
5657
return {
5758
getToken: forceRefresh => getToken(appCheck, forceRefresh),
59+
getLimitedUseToken: () => getLimitedUseToken(appCheck),
5860
addTokenListener: listener =>
5961
addTokenListener(appCheck, ListenerType.INTERNAL, listener),
6062
removeTokenListener: listener => removeTokenListener(appCheck.app, listener)

packages/app-check/src/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ export interface FirebaseAppCheckInternal {
2424
// is present. Returns null if no token is present and no token requests are in-flight.
2525
getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>;
2626

27+
// Get a Limited use Firebase App Check token. This method should be used
28+
// only if you need to authorize requests to a non-Firebase backend. Returns null if no token is present and no token requests are in-flight.
29+
getLimitedUseToken(): Promise<AppCheckTokenResult>;
30+
2731
// Registers a listener to changes in the token state. There can be more than one listener
2832
// registered at the same time for one or more FirebaseAppAttestation instances. The
2933
// listeners call back on the UI thread whenever the current token associated with this

0 commit comments

Comments
 (0)