Skip to content

Commit 661922d

Browse files
committed
add auth
1 parent 186d3b9 commit 661922d

File tree

6 files changed

+26
-9
lines changed

6 files changed

+26
-9
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ node_modules
33
next.config.js
44
.now
55
components/auth.json
6-
id_cache.json
6+
id_cache.json
7+
.vercel
8+
public/feed.rss
9+
.env.local
10+
.env

components/auth.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export default {
2+
type: "service_account",
3+
project_id: "notebook-72b94",
4+
private_key_id: process.env.FIREBASE_PRIVATE_KEY_ID,
5+
private_key: process.env.FIREBASE_PRIVATE_KEY.replace(/\\n/g, '\n'),
6+
client_email:
7+
8+
client_id: "101991115029094574735",
9+
auth_uri: "https://accounts.google.com/o/oauth2/auth",
10+
token_uri: "https://oauth2.googleapis.com/token",
11+
auth_provider_x509_cert_url: "https://www.googleapis.com/oauth2/v1/certs",
12+
client_x509_cert_url:
13+
"https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-sqe2k%40notebook-72b94.iam.gserviceaccount.com",
14+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"start": "next"
77
},
88
"engines": {
9-
"node": "16.13.0"
9+
"node": "16"
1010
},
1111
"repository": {
1212
"type": "git",

pages/api/get.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import * as admin from "firebase-admin";
2-
import config from "../../components/auth.json";
3-
try {
2+
import config from "../../components/auth.js";
3+
console.log(config)
44
admin.initializeApp({
55
credential: admin.credential.cert(config),
66
databaseURL: "https://notebook-72b94.firebaseio.com",
77
});
8-
} catch {}
98

109
export const local = async (id) => {
1110
let snap = await admin.firestore().collection("stars").doc(id).get();

pages/api/upvote.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as admin from "firebase-admin";
2-
import config from "../../components/auth.json";
2+
import config from "../../components/auth.js";
33
try {
44
admin.initializeApp({
55
credential: admin.credential.cert(config),

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,9 +1021,9 @@ callsites@^3.0.0:
10211021
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
10221022

10231023
caniuse-lite@^1.0.30001173, caniuse-lite@^1.0.30001179:
1024-
version "1.0.30001208"
1025-
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001208.tgz#a999014a35cebd4f98c405930a057a0d75352eb9"
1026-
integrity sha512-OE5UE4+nBOro8Dyvv0lfx+SRtfVIOM9uhKqFmJeUbGriqhhStgp1A0OyBpgy3OUF8AhYCT+PVwPC1gMl2ZcQMA==
1024+
version "1.0.30001434"
1025+
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001434.tgz"
1026+
integrity sha512-aOBHrLmTQw//WFa2rcF1If9fa3ypkC1wzqqiKHgfdrXTWcU8C4gKVZT77eQAPWN1APys3+uQ0Df07rKauXGEYA==
10271027

10281028
[email protected], chalk@^2.0.0, chalk@^2.4.2:
10291029
version "2.4.2"

0 commit comments

Comments
 (0)