Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

passport-firebase-jwt

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-firebase-jwt - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

.idea/misc.xml

5

package.json
{
"name": "passport-firebase-jwt",
"version": "1.0.0",
"version": "1.1.0",
"description": "Passport authentication strategy for Firebase JWT token",

@@ -33,3 +33,4 @@ "main": "./lib",

"mocha": "^6.1.4",
"sinon": "^1.0.0"
"sinon": "^1.0.0",
"typescript": "^4.3.2"
},

@@ -36,0 +37,0 @@ "dependencies": {

47

README.md
# passport-firebase-jwt
Based on [passport-jwt](https://github.com/mikenicholson/passport-jwt)
A [Passport](http://passportjs.org/) strategy for authenticating with a Firebase Auth.
This module lets you authenticate endpoints when using Firebase Auth.
A [Passport](http://passportjs.org/) strategy to authenticate with Firebase Auth.
This module lets you authenticate endpoints when using Firebase Auth in a Node.js application.
## Install

@@ -16,3 +17,25 @@

Strategy name is: `firebase-jwt`.
#### index.ts
Make sure firebase is initialized before starting NestJs
```ts
import { credential, initializeApp } from 'firebase-admin';
import * as express from 'express';
import * as serviceAccount from './serviceAccountKey.json';
const config = {
apiKey: '***',
authDomain: '***.firebaseapp.com',
databaseURL: 'https://***.firebaseio.com',
projectId: '***',
storageBucket: '***.appspot.com',
messagingSenderId: '***',
credential: credential.cert(***)
};
initializeApp(config);
```
#### firebase-auth.strategy.ts
```ts
import { PassportStrategy } from '@nestjs/passport';

@@ -43,2 +66,22 @@ import { Injectable, UnauthorizedException } from '@nestjs/common';

#### auth.module.ts
```ts
import { Module } from '@nestjs/common';
import { PassportModule } from '@nestjs/passport';
import { FirebaseAuthStrategy } from './firebase-auth.strategy';
@Module({
imports: [
PassportModule.register({ defaultStrategy: 'firebase-jwt' })
],
providers: [
FirebaseAuthStrategy
],
exports: [
PassportModule
]
})
export class AuthModule {}
```
### Extracting the JWT from the request

@@ -45,0 +88,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc