This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

adonis5-firebase-admin
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

⛔️ DEPRECATED

Actually, we don't use this repository anymore and it suffers from a lack of dependency updates that can create security issues. You can freely use the code to create your own firebase integration

Table of contents

Adonis5-Firebase-Admin

Adonisjs 5, Firebase admin, Firebase for Adonis5

nomaintenance-image typescript-image license-image npm-image

Firebase admin providers for AdonisJS 5

Installation

npm i --save adonis5-firebase-admin

Compile your code:

node ace serve --watch

Connect all dependences:

node ace invoke adonis5-firebase-admin
  • For other configuration, please update the config/firebase.ts.

Usage

After adding firebase-admin provider to your app, you can import firebaseAdmin to access all the functions of the firebase admin

import firebaseAdmin from '@ioc:Adonis/Addons/FirebaseAdmin'
  • For example, you can create a middleware to check if the user is authenticated.
node ace make:middleware Authenticate
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
import firebaseAdmin from '@ioc:Adonis/Addons/FirebaseAdmin'

export default class Authenticate {
  public async handle ({ request, response }: HttpContextContract, next: () => Promise<void>) {
    const idToken = request.header('Authorization') as string
    firebaseAdmin.auth().verifyIdToken(idToken)
      .then(async function (decodedToken) {
        const uid = decodedToken.uid
        ...
        await next()
      }).catch(function (error) {
        response.status(401).send(error)
      })
  }
}

For additional details of Firebase Admin API, please check the Firebase SDK documentation by this link Firebase docs

Package Sidebar

Install

npm i adonis5-firebase-admin

Weekly Downloads

26

Version

1.1.1

License

MIT

Unpacked Size

12 kB

Total Files

14

Last publish

Collaborators

  • rollivier