Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

285
Views
Angular2 + firebase-admin sdk

When i try to use firebase-admin SDK in my angular2 project i get this error

ERROR in ./~/firebase-admin/lib/auth/token-generator.js
Module not found: Error: Can't resolve 'jsonwebtoken' in '/home/koucky/git_projects/zlepsito-web/node_modules/firebase-admin/lib/auth'
 @ ./~/firebase-admin/lib/auth/token-generator.js 7:10-33
 @ ./~/firebase-admin/lib/auth/auth.js
 @ ./~/firebase-admin/lib/auth/register-auth.js
 @ ./~/firebase-admin/lib/index.js
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

I installed firebase-admin via npm and in my app.module.ts i tryed to use it like this import 'firebase-admin' or var admin = require("firebase-admin"); both ways produce that error.

I have followed: https://firebase.google.com/docs/admin/setup

app.module.ts

var admin = require("firebase-admin");

var serviceAccount = require('./serviceAccountKey.json');

admin.initializeApp({
  credential: admin.credential.cert(serviceAccount),
  databaseURL: "https://myapp-99f41.firebaseio.com"
}); 

Does anyone know what to do, or is able to provide a snippet how to use firebase-admin SDK with angular2 project?

Thanks in advance

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I have a similar problem. Got one step further, but still not all the way.

Did a

npm install jsonwebtoken --save

which made the jsonwebtoken error disapear. Next error: missing 'dns', which was solved with:

npm install dns --save

Now i get an error saying 'Invalid left-hand side in assignment'.

I have used this method to call initializeApp instead of the key.json.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!