firebasejwtgraphqlgraphcool

firebase auth token from Graphcool


can I generate a custom auth token, for use with a third party, with a resolver in graph.cool? something like this??

type FirebaseTokenPayload {
  token: String!
}

extend type Query {
    FirebaseToken(userIdentifier:  String!): FirebaseTokenPayload
}
const fb = require('myNodeFirebaseAuthLib')
module.exports = event => fb.generateTokenWithPayload({ id: event.data.userId })

Authentication required - restrict who can read data in fields: Permission query:

query ($user_id: ID!, $node_firebaseIdentifier: String) {
  SomeUserExists(filter: { 
    id: $user_id ,
    firebaseIdentifier: $node_firebaseIdentifier
  })
}

-- I think this question boils down two parts

notes, addendums:

according to this alligator.io blog post, it seems that using the Graphcool framework, you can install node modules! So, I wouldn't need to use a webhook. -- However, that is with an ejected app. I lose auth0 authentication that way -- the template does not produce a createUser and singinUser that works with the same auth0 data that the integration offers.


Solution

  • I forgot to post the answer to this - I had to eject graphcool, I could not use any node_modules I thought to try in my custom functions.