sebastiangug / passport-google-token

MIT License
42 stars 42 forks source link

TokenStrategy is not a constructor #17

Open bolutife-lawrence opened 7 years ago

bolutife-lawrence commented 7 years ago

Looks like passport-google-token is having some trouble registering.

 express:router:route delete /auth/google/:__feathersId +0ms
  express:router:layer new / +0ms
  express:router:route delete /auth/google/:__feathersId +0ms
  express:router:layer new / +0ms
  express:router:route delete /auth/google/:__feathersId +0ms
  express:router:layer new / +0ms
  feathers-authentication:oauth2 registering passport-google OAuth2 strategy +1ms
  feathers-authentication:oauth2 registering passport-google-token OAuth2 strategy +1ms
/Users/lawrencebolutife/Documents/kunibooks_api/node_modules/feathers-authentication/lib/services/oauth2.js:49
      _passport2.default.use(new TokenStrategy(options, service.oauthCallback.bind(service)));
                             ^

TypeError: TokenStrategy is not a constructor
MaxCaribe commented 7 years ago

I had the same problem and found solution to import strategy in such way: var GoogleTokenStrategy = require('passport-google-token').Strategy

bolutife-lawrence commented 7 years ago

That's the exact way I had it imported @MaxCaribe. The problem was leaving in the dummy text Place you client secret here ... or something like that, in the app's config for authentication. Using an empty string instead, solved the problem.

lakmalniranga commented 6 years ago

You can use es6 syntax like import { Strategy as GoogleTokenStrategy } from 'passport-google-token'