Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: has no method 'authorize' #3

Closed
anti1234 opened this issue Mar 4, 2016 · 3 comments
Closed

Error: has no method 'authorize' #3

anti1234 opened this issue Mar 4, 2016 · 3 comments
Assignees

Comments

@anti1234
Copy link

anti1234 commented Mar 4, 2016

Hi, I got this error while I run the example showed on README.

TypeError: Object [object Object] has no method 'authorize'
W20160304-16:16:35.383(8)? (STDERR)     at server/oauth2server.js:21:56
W20160304-16:16:35.383(8)? (STDERR)     at /home/ljm/simple-todos/.meteor/local/build/programs/server/app/server/oauth2server.js:39:4
W20160304-16:16:35.383(8)? (STDERR)     at /home/ljm/simple-todos/.meteor/local/build/programs/server/boot.js:242:10
W20160304-16:16:35.383(8)? (STDERR)     at Array.forEach (native)
W20160304-16:16:35.383(8)? (STDERR)     at Function._.each._.forEach (/root/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20160304-16:16:35.384(8)? (STDERR)     at /home/ljm/simple-todos/.meteor/local/build/programs/server/boot.js:137:5

It seems this error is caused by this function:

oauth2server.routes.get('/account', oauth2server.oauth.authorize(), function(req, res, next) {
  var user = Meteor.users.findOne(req.user.id);

  res.send({
    id: user._id,
    name: user.name
  });
});

I am so confused that authorize has been implemented by node-oauth2-server , why the error occurred ?

😆 So so appreciate for any idea !

@anti1234
Copy link
Author

anti1234 commented Mar 4, 2016

Well, it works when I change the authorize() to authorise() .

Then I check the code download from npm install oauth-server . It is different from node-oauth2-server

😆 Whatever, it works now .

@engelgabriel
Copy link
Member

Thanks for point our the inconsistency.

Please @rodrigok can we do a global search and replace on the repo to fix this?

@rodrigok
Copy link
Member

rodrigok commented Mar 4, 2016

Fixed via 5f3904e?ts=2

@rodrigok rodrigok closed this as completed Mar 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants