當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript firebase-admin.credential類代碼示例

本文整理匯總了TypeScript中firebase-admin.credential的典型用法代碼示例。如果您正苦於以下問題:TypeScript credential類的具體用法?TypeScript credential怎麽用?TypeScript credential使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了credential類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: openFirebaseDashboardApp

export function openFirebaseDashboardApp() {
  // Initialize the Firebase application with firebaseAdmin credentials.
  // Credentials need to be for a Service Account, which can be created in the Firebase console.
  return firebaseAdmin.initializeApp({
    databaseURL: dashboardDatabaseUrl,
    credential: firebaseAdmin.credential.cert({
      project_id: 'material2-board',
      client_email: 'material2-board@appspot.gserviceaccount.com',
      // In Travis CI the private key will be incorrect because the line-breaks are escaped.
      // The line-breaks need to persist in the service account private key.
      private_key: decode(process.env['MATERIAL2_BOARD_FIREBASE_SERVICE_KEY']!)
    }),
  });
}
開發者ID:OkBayat,項目名稱:material2,代碼行數:14,代碼來源:firebase.ts

示例2: openFirebaseDashboardApp

export function openFirebaseDashboardApp() {
  // Initialize the Firebase application with firebaseAdmin credentials.
  // Credentials need to be for a Service Account, which can be created in the Firebase console.
  return firebaseAdmin.initializeApp({
    credential: firebaseAdmin.credential.cert({
      project_id: 'material2-dashboard',
      client_email: 'firebase-adminsdk-ch1ob@material2-dashboard.iam.gserviceaccount.com',
      // In Travis CI the private key will be incorrect because the line-breaks are escaped.
      // The line-breaks need to persist in the service account private key.
      private_key: decode(process.env['MATERIAL2_DASHBOARD_FIREBASE_KEY'])
    }),
    databaseURL: 'https://material2-dashboard.firebaseio.com'
  });
}
開發者ID:StefanSinapov,項目名稱:material2,代碼行數:14,代碼來源:firebase.ts

示例3: require

import * as admin from 'firebase-admin';
import * as cors from 'cors';
import * as compression from 'compression';
import * as express from 'express';
import * as functions from 'firebase-functions';
import * as crypto from 'crypto';
import notifyWatch from './transforms/notifyWatch';
import transcriptHandler from './endpoints/transcriptHandler';
import evaluationsHandler from './endpoints/evaluationsHandler';

const serviceAccount = require('../service-account.json');

admin.initializeApp(
  Object.assign({}, functions.config().firebase, {
    credential: admin.credential.cert(serviceAccount),
  }),
);

const app = express();

app.use(cors());
app.use(compression());

// Parse authentication headers if available.
app.use((req, res, next) => {
  const authorization = req.get('authorization');
  if (authorization) {
    const credentials = new Buffer(authorization.split(' ').pop(), 'base64')
      .toString('ascii')
      .split(':');
    req['username'] = credentials[0];
開發者ID:kevmo314,項目名稱:canigraduate.uchicago.edu,代碼行數:31,代碼來源:index.ts

示例4:

import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';

admin.initializeApp(functions.config().firebase);
const db = admin.firestore();



admin.initializeApp({
  credential: admin.credential.applicationDefault(),
  // storageBucket: "gin-manga.appspot.com",
  // databaseURL: 'https://<DATABASE_NAME>.firebaseio.com'
  projectId: 'gin-manga'
});



const firestore = admin.firestore();


const mangahere = firestore.collection('manga_here');






// // Start writing Firebase Functions
// // https://firebase.google.com/docs/functions/typescript
//
export const helloWorld = functions.https.onRequest((request, response) => {
開發者ID:pikax,項目名稱:gincloud,代碼行數:31,代碼來源:index.ts

示例5: getInstance

 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import * as firebase from 'firebase-admin';
import * as firebaseServiceAccountJson from "../service-account-firebase.json";
import PlayDeveloperApiClientMock from './mocks/PlayDeveloperApiClientMock';
import DateMock from './mocks/DateMock';
import { PlayBilling } from '../../src/play-billing';

const firebaseServiceAccount:any = firebaseServiceAccountJson;
const TEST_FIREBASE_APP_NAME = 'libraryTestApp';
firebase.initializeApp({
  credential: firebase.credential.cert(firebaseServiceAccount),
  databaseURL: "https://ghdemo-b25b3.firebaseio.com"
}, TEST_FIREBASE_APP_NAME);

export class TestConfig {
  private static _instance: TestConfig;
  private _playBilling: PlayBilling;
  private _playApiClientMock: PlayDeveloperApiClientMock;
  private _dateMock: DateMock;
  
  static getInstance(): TestConfig {
    if (this._instance) {
      return this._instance;
    } else {
      this._instance = new TestConfig();
      return this._instance;
開發者ID:StarshipVendingMachine,項目名稱:android-play-billing,代碼行數:31,代碼來源:TestConfig.ts

示例6: require

import firebaseAdmin, { firestore } from 'firebase-admin';
import { WhereFilterOp } from '@google-cloud/firestore';

// Import .js libs
const container = require('auto-node').Container;

// Import project .ts files
import Category from '../models/category';
import Lockable from '../models/lockable';
import SitePool from '../models/sitepool';
import IService from '../models/iservice';
import ISetting from '../models/isetting';

// Import credential
firebaseAdmin.initializeApp({
    credential: firebaseAdmin.credential.cert('../../Aperture-Test-Manager-V2-8e1d10e8342c.json')
});

const db = firebaseAdmin.firestore();

// [Firestore Specific Helpers]

/**
 * Whether to retrieve the Firestore entity by name or id.
 */
export enum RetrieveBy {
    ID,
    NAME
};

/**
開發者ID:alexHayes08,項目名稱:ApertureTestManager,代碼行數:31,代碼來源:firestore-service.ts


注:本文中的firebase-admin.credential類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。