npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vendure-plugin-firebase-auth

v0.3.3

Published

Allows users to authenticate with Firebase Auth to Shop-API

Downloads

7

Readme

README.md

# Vendure Plugin Firebase Auth for Shop-API

This package is a Vendure plugin that allows authentication using Firebase Auth.

## Installation

```sh
npm install vendure-plugin-firebase-auth

Download the google-service.json file from Firebase and save it in the root of your project. in your environment variables, add the following:

FIREBASE_SERVICE_ACCOUNT=google-service.json FIREBASE_DATABASE_URL=https://.firebaseio.com

Configuration

In your Vendure config, import and use the FirebaseAuthPlugin.

import { FirebaseAuthPlugin } from "vendure-plugin-firebase-auth";

const config = {
  plugins: [
    FirebaseAuthPlugin.init({
      serviceAccount: process.env.FIREBASE_SERVICE_ACCOUNT,
      databaseURL: process.env.FIREBASE_DATABASE_URL,
      registerCustomer: true, //if email is present, create customer in Vendure
      registerUser: true, //create user in Vendure without email
    }),
    // other plugins...
  ],
};

Options

The FirebaseAuthPlugin accepts the following options:

  • serviceAccount: The service account object for Firebase.
  • databaseURL: The Firebase database URL.
  • registerCustomer: true, //if email is present, create customer in Vendure
  • registerUser: true, //create user in Vendure without email

Usage

After setting up the plugin, you can use the authenticate mutation to authenticate a user using Firebase Auth. You can then use the getSession query to get the session of the currently authenticated user.

mutation{
  authenticate(input:{
    firebase:{
      jwt:"eyJhbGciOiJSUzI1NiIsImtpZCI6IjFkYmUwNmI1ZDdjMmE3YzA0NDU2MzA2MWZmMGZlYTM3NzQwYjg2YmMiLCJ0eXAiOiJKV1QifQ.eyJwcm92aWRlcl9pZCI6ImFub255bW91cyIsImlzcyI6Imh0dHBzOi8vc2VjdXJldG9rZW4uZ29vZ2xlLmNvbS96aWt6YWt6aWt6YWt3dGYiLCJhdWQiOiJ6aWt6YWt6aWt6YWt3dGYiLCJhdXRoX3RpbWUiOjE3MjI0MzYyMTcsInVzZXJfaWQiOiJlTVROUGtkR283VnowNE9nQmRNTEhDTjhmQUcyIiwic3ViIjoiZU1UTlBrZEdvN1Z6MDRPZ0JkTUxIQ044ZkFHMiIsImlhdCI6MTcyMjQzNjIxNywiZXhwIjoxNzIyNDM5ODE3LCJmaXJlYmFzZSI6eyJpZGVudGl0aWVzIjp7fSwic2lnbl9pbl9wcm92aWRlciI6ImFub255bW91cyJ9fQ.sumcW-_NnWCsX_l7i17TfOA5MC-b30JbYhEysAwX6p7J_ljPXIMDNQPLmoCbu75srLWqzMhpfIoCYyctEVFSYFsRyJnRUt5pjOAAE86LuAam_9-8iWraQUQgtIjG09PGOe5d4BoKhMP6R9e06A6K74Sg98lda8QwVYWxHUD9lrvBglO3y5r-LC-hnqhLXx3GO4f9lmhoBCxQ4AuZ-gp4-5JUQwtmbxRZdCQT4tWm5T4-flLvFP_Vbjhy369KIH9aMNgpuFXM2g88Qfxu277Lb7gwv4ObjZu6MeUEMpLQo49S0Jfx64lTwmDJmuqUvxiD_Ck0yvY9n_123456789OQPR",
      uid:"eMTNPkdGo7Vz04OgBdMLHXXXXXXX"
    }
  }){
    __typename
  }
}
query{
    getSession {
      activeOrderId
      cacheExpiry
      expires
      activeChannelId
      user {
        id
        identifier
        verified
      }
    }
}

Contributing

Contributions are welcome! Please open an issue or submit a pull request on the GitHub repository.