refreshToken method

Credential refreshToken(
  1. JSAny refreshTokenPathOrObject, [
  2. Agent httpAgent
])

Returns a credential created from the provided refresh token that grants admin access to Firebase services. This credential can be used in the call to {@link firebase-admin.app#initializeApp}.

See {@link https://firebase.google.com/docs/admin/setup#initialize_the_sdk | Initialize the SDK} for more details.

@example

// Providing a path to a refresh token JSON file
const refreshToken = require("path/to/refreshToken.json");
initializeApp({
  credential: refreshToken(refreshToken),
  databaseURL: "https://<DATABASE_NAME>.firebaseio.com"
});

@param refreshTokenPathOrObject - The path to a Google OAuth2 refresh token JSON file or an object representing a Google OAuth2 refresh token. @param httpAgent - Optional {@link https://nodejs.org/api/http.html#http_class_http_agent | HTTP Agent} to be used when retrieving access tokens from Google token servers.

@returns A credential authenticated via the provided service account that can be used to initialize an app.

Implementation

external Credential refreshToken(
  JSAny refreshTokenPathOrObject, [
  Agent httpAgent,
]);