Skip to content

jordonmckoy/nexus-plugin-firebase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nexus-plugin-firebase

Contents

Installation

npm install nexus-plugin-firebase

Example Usage

Ensure the GOOGLE_APPLICATION_CREDENTIALS env is set

import { firebase } from 'nexus-plugin-firebase';

use(prisma());
use(
  firebase({
    databaseURL: 'https://my-firebase-project.firebaseio.com',
  })
);

/* ... */

schema.mutationType({
  definition(t) {
    t.field('signup', {
      type: 'AuthPayload',
      args: {
        firstName: schema.stringArg({ nullable: false }),
        email: schema.stringArg({ nullable: false }),
        password: schema.stringArg({ nullable: false }),
      },
      resolve: async (
        _parent,
        { firstName, email, password },
        ctx
      ) => {
          ctx.admin.auth().createUser({
            email,
            emailVerified: false,
            password,
            displayName: `${firstName}`,
            disabled: false,
          }).then(function(userRecord) {
            console.log('Successfully created new user:', userRecord.uid);
          }).catch(function(error) {
            console.log('Error creating new user:', error);
          });
      },
    });
  }
});

What is nexus-plugin-firebase

The quickest and easiest way to get started with Firebase and Nexus. This plugin is a wrapper around the firebase-admin package. It exposes the Firebase admin object through resolver context, providing full access to the firebase-admin API.

Worktime Contributions

TODO

Runtime Contributions

TODO

Testtime Contributions

TODO

Links

https://nexusjs.org

https://firebase.google.com/docs/auth/admin

About

Nexus plugin for the Firebase Admin SDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •