dsdenes / hapi-auth-firebase

Hapi authentication plugin to verify JWT token provided by the firebase client library.
9 stars 4 forks source link

Error on register Hapi Plugin #4

Open joaom182 opened 6 years ago

joaom182 commented 6 years ago
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(errorFunc, errorContext) {
                                             ^

ReferenceError: regeneratorRuntime is not defined
    at /Users/joao/Projects/eipets/api/node_modules/hapi-auth-firebase/lib/index.js:4:46
    at Object.<anonymous> (/Users/joao/Projects/eipets/api/node_modules/hapi-auth-firebase/lib/index.js:27:2)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/joao/Projects/eipets/api/src/auth/firebase-register.js:1:88)

I'm using node v7.10.0 and hapi 16.6.2 and hapi-auth-firebase 1.0.4

joaom182 commented 6 years ago

This issue is because my project not use babel to transpile and enbale async feature.

Quentintin commented 6 years ago

Please can you tell me how do you solve this problem ?

danieltodonnell commented 6 years ago

I'm still seeing this error

"dependencies": { "firebase": "^4.12.1", "firebase-admin": "^5.12.0", "hapi": "^17.3.1", "hapi-auth-firebase": "^1.0.4", "hapi-pino": "^4.0.4", "inert": "^5.1.0", "regenerator-runtime": "^0.11.1" }

Quentintin commented 6 years ago

The solution for me was to copy/paste src/index.js into my project, and then require my local file in project

More easily, you can try : const hapiAuthFirebase = require('hapi-auth-firebase/src');

holtc commented 5 years ago

Getting the following error when following the advice from @Quentintin

node_modules/hapi-auth-firebase/src/index.js:71
function verifyToken(firebaseAdmin, token: String) {
                                         ^

SyntaxError: Unexpected token :

Any ideas?