|
| 1 | +/*! |
| 2 | + * Copyright 2020 Google Inc. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +// TODO: According to the typings this is part of the Firebase Namespace today |
| 18 | +// and not credential; it will need to be moved accordingly. |
| 19 | +/** |
| 20 | + * Interface for Google OAuth 2.0 access tokens. |
| 21 | + */ |
| 22 | +export interface GoogleOAuthAccessToken { |
| 23 | + /* tslint:disable:variable-name */ |
| 24 | + access_token: string; |
| 25 | + expires_in: number; |
| 26 | + /* tslint:enable:variable-name */ |
| 27 | +} |
| 28 | + |
| 29 | +/** |
| 30 | + * Interface that provides Google OAuth2 access tokens used to authenticate |
| 31 | + * with Firebase services. |
| 32 | + * |
| 33 | + * In most cases, you will not need to implement this yourself and can instead |
| 34 | + * use the default implementations provided by |
| 35 | + * {@link admin.credential `admin.credential`}. |
| 36 | + */ |
| 37 | +export interface Credential { |
| 38 | + /** |
| 39 | + * Returns a Google OAuth2 access token object used to authenticate with |
| 40 | + * Firebase services. |
| 41 | + * |
| 42 | + * This object contains the following properties: |
| 43 | + * * `access_token` (`string`): The actual Google OAuth2 access token. |
| 44 | + * * `expires_in` (`number`): The number of seconds from when the token was |
| 45 | + * issued that it expires. |
| 46 | + * |
| 47 | + * @return A Google OAuth2 access token object. |
| 48 | + */ |
| 49 | + getAccessToken(): Promise<GoogleOAuthAccessToken>; |
| 50 | +} |
0 commit comments