| * Copyright 2017 Google LLC |
| * SPDX-License-Identifier: Apache-2.0 |
| import {Finalizable} from '../registry'; |
| XSRF_TOKEN = 'xsrf_token', |
| ACCESS_TOKEN = 'access_token', |
| export type GetTokenCallback = () => Promise<Token | null>; |
| export interface DefaultAuthOptions { |
| credentials: RequestCredentials; |
| export interface AuthRequestInit extends RequestInit { |
| // RequestInit define headers as HeadersInit, i.e. |
| // Headers | string[][] | Record<string, string> |
| // Auth class supports only Headers in options |
| export interface AuthService extends Finalizable { |
| * Returns if user is authed or not. |
| authCheck(): Promise<boolean>; |
| * Enable cross-domain authentication using OAuth access token. |
| setup(getToken: GetTokenCallback, defaultOptions: DefaultAuthOptions): void; |
| * Perform network fetch with authentication. |
| fetch(url: string, opt_options?: AuthRequestInit): Promise<Response>; |