UNPKG

1.77 kBTypeScriptView Raw
1/*! firebase-admin v10.0.0 */
2/*!
3 * @license
4 * Copyright 2017 Google Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18import { Credential } from './credential';
19/**
20 * Type representing a Firebase OAuth access token (derived from a Google OAuth2 access token) which
21 * can be used to authenticate to Firebase services such as the Realtime Database and Auth.
22 */
23export interface FirebaseAccessToken {
24 accessToken: string;
25 expirationTime: number;
26}
27/**
28 * Internals of a FirebaseApp instance.
29 */
30export declare class FirebaseAppInternals {
31 private credential_;
32 private cachedToken_;
33 private tokenListeners_;
34 constructor(credential_: Credential);
35 getToken(forceRefresh?: boolean): Promise<FirebaseAccessToken>;
36 getCachedToken(): FirebaseAccessToken | null;
37 private refreshToken;
38 private shouldRefresh;
39 /**
40 * Adds a listener that is called each time a token changes.
41 *
42 * @param listener - The listener that will be called with each new token.
43 */
44 addAuthTokenListener(listener: (token: string) => void): void;
45 /**
46 * Removes a token listener.
47 *
48 * @param listener - The listener to remove.
49 */
50 removeAuthTokenListener(listener: (token: string) => void): void;
51}