Skip to content

Commit d4b97bf

Browse files
author
Nicolas Garnier
committed
Simplifying the authorized-https-endpoint sample since default credentials can be used now
Change-Id: Ic0ab9d53a1ef48c4773730511390937c200044ca
1 parent 8e3ebcb commit d4b97bf

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

Diff for: authorized-https-endpoint/README.md

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ This sample comes with a simple web-based UI which code is in [public](public) d
1717
1. Enable the **Google** Provider in the **Auth** section.
1818
1. Clone or download this repo and open the `authenticated-https-endpoint` directory.
1919
1. Paste the Web initialization snippet from: **Firebase Console > Overview > Add Firebase to your web app** in the `public/index.html` where the `TODO` is located.
20-
1. Download a Service Account credentials from: **Firebase Console > ⚙ > Project Settings > SERVICE ACCOUNTS > GENERATE NEW PRIVATE KEY** and save the file as `functions/service-account.json`.
21-
1. Configure the CLI locally by using `firebase use --add` and select your project in the list.
2220
1. You must have the Firebase CLI installed. If you don't have it install it with `npm install -g firebase-tools` and then configure it with `firebase login`.
2321
1. Configure the CLI locally by using `firebase use --add` and select your project in the list.
2422
1. Install dependencies locally by running: `cd functions; npm install; cd -`

Diff for: authorized-https-endpoint/functions/index.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@
1717

1818
const functions = require('firebase-functions');
1919
const admin = require('firebase-admin');
20-
const credentials = require('./service-account.json');
21-
admin.initializeApp({
22-
credential: admin.credential.cert(credentials),
23-
databaseURL: `https://${credentials.project_id}.firebaseio.com`
24-
});
20+
admin.initializeApp(functions.config().firebase);
2521
const express = require('express');
2622
const cors = require('cors')({origin: true});
2723
const app = express();

Diff for: authorized-https-endpoint/functions/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dependencies": {
55
"cors": "^2.8.1",
66
"express": "^4.14.1",
7-
"firebase-admin": "^4.1.1",
7+
"firebase-admin": "^4.1.2",
88
"firebase-functions": "https://storage.googleapis.com/firebase-preview-drop/node/firebase-functions/firebase-functions-preview.latest.tar.gz"
99
}
1010
}

0 commit comments

Comments
 (0)