Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add limited token support for functions
  • Loading branch information
ssbushi authored and avolkovi committed May 11, 2023
commit 8faaddc5db76e6a78eadb181b27d102d79000853
1 change: 1 addition & 0 deletions common/api-review/functions.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function httpsCallableFromURL<RequestData = unknown, ResponseData = unkno
// @public
export interface HttpsCallableOptions {
timeout?: number;
useLimitedUseAppCheckToken?: boolean;
}

// @public
Expand Down
4 changes: 4 additions & 0 deletions packages/app-check-interop-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export interface FirebaseAppCheckInternal {
// is present. Returns null if no token is present and no token requests are in-flight.
getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>;

// Gets a limited use Firebase App Check token. This method should be used
// only if you need to authorize requests to a non-Firebase backend.
getLimitedUseToken(): Promise<AppCheckTokenResult>;

// Registers a listener to changes in the token state. There can be more than one listener
// registered at the same time for one or more FirebaseAppAttestation instances. The
// listeners call back on the UI thread whenever the current token associated with this
Expand Down
2 changes: 2 additions & 0 deletions packages/app-check/src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { FirebaseApp, _FirebaseService } from '@firebase/app';
import { FirebaseAppCheckInternal, ListenerType } from './types';
import {
getToken,
getLimitedUseToken,
addTokenListener,
removeTokenListener
} from './internal-api';
Expand Down Expand Up @@ -55,6 +56,7 @@ export function internalFactory(
): FirebaseAppCheckInternal {
return {
getToken: forceRefresh => getToken(appCheck, forceRefresh),
getLimitedUseToken: () => getLimitedUseToken(appCheck),
addTokenListener: listener =>
addTokenListener(appCheck, ListenerType.INTERNAL, listener),
removeTokenListener: listener => removeTokenListener(appCheck.app, listener)
Expand Down
4 changes: 4 additions & 0 deletions packages/app-check/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export interface FirebaseAppCheckInternal {
// is present. Returns null if no token is present and no token requests are in-flight.
getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>;

// Get a Limited use Firebase App Check token. This method should be used
// 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.
getLimitedUseToken(): Promise<AppCheckTokenResult>;

// Registers a listener to changes in the token state. There can be more than one listener
// registered at the same time for one or more FirebaseAppAttestation instances. The
// listeners call back on the UI thread whenever the current token associated with this
Expand Down
Loading