0

我正在使用https://github.com/ganarajpr/express-angular并在尝试运行应用程序时收到此错误:

git clone https://github.com/ganarajpr/express-angular.git && cd express-angular/ && npm install && nodemon app.js

$ nodemon app.js 
26 Oct 09:55:31 - [nodemon] v0.7.10
26 Oct 09:55:31 - [nodemon] to restart at any time, enter `rs`
26 Oct 09:55:31 - [nodemon] watching: /Users/qihanzhang/git/express-angular
26 Oct 09:55:31 - [nodemon] starting `node app.js`
connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
connect.limit() will be removed in connect 3.0

/Users/qihanzhang/git/express-angular/node_modules/everyauth/lib/modules/everymodule.js:133
      throw new Error(debugMsg);
            ^
Error: WARNING: You are trying to access the attribute/method configured by `consumerKey`, which you did not configure. Time to configure it.
    at EveryModule.(anonymous function) [as consumerKey] (/Users/qihanzhang/git/express-angular/node_modules/everyauth/lib/modules/everymodule.js:133:13)
    at EveryModule.<anonymous> (/Users/qihanzhang/git/express-angular/node_modules/everyauth/lib/modules/oauth.js:27:14)
    at EveryModule.init (/Users/qihanzhang/git/express-angular/node_modules/everyauth/lib/modules/everymodule.js:77:8)
    at EveryModule.routeApp (/Users/qihanzhang/git/express-angular/node_modules/everyauth/lib/modules/everymodule.js:270:23)
    at Object.everyauth.middleware (/Users/qihanzhang/git/express-angular/node_modules/everyauth/index.js:38:15)
    at Function.app.configure.app.use.express.errorHandler.dumpExceptions (/Users/qihanzhang/git/express-angular/app.js:103:21)
    at Function.app.configure (/Users/qihanzhang/git/express-angular/node_modules/express/lib/application.js:391:61)
    at Object.<anonymous> (/Users/qihanzhang/git/express-angular/app.js:92:5)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
26 Oct 09:55:31 - [nodemon] app crashed - waiting for file changes before starting...

我不确定这个 consumerKey 应该在哪里配置,我查看了 everymodule.js 但只找到了这个:

/**
 * Convenience method for all you coffee-script lovers, e.g.,
 *
 * everyauth.dropbox.configure
 *   consumerKey:       conf.dropbox.consumerKey
 *   consumerSecret:    conf.dropbox.consumerSecret
 *   findOrCreateUser:  (sess, accessToken, accessSecret, dbMeta) -> users[dbMeta.uid] or= addUser('dropbox', dbMeta)
 *   redirectPath:      '/'
 */
EveryModule.prototype.configure = function (conf) {
  for (var k in conf) {
    this[k](conf[k]);
  }
  return this;
};

任何想法在哪里/如何配置此密钥?我想我在 node_modules/everyauth/lib/modules/oauth.js 中找到了它,但是我还需要配置所有其他字段吗?谢谢!

var oauth = module.exports =
everyModule.submodule('oauth')
  .configurable({
      apiHost: 'e.g., https://api.twitter.com'
    , oauthHost: 'the host for the OAuth provider'
    , requestTokenPath: "the path on the OAuth provider's domain where we request the request token, e.g., /oauth/request_token"
    , accessTokenPath: "the path on the OAuth provider's domain where we request the access token, e.g., /oauth/access_token"
    , authorizePath: 'the path on the OAuth provider where you direct a visitor to login, e.g., /oauth/authorize'
    , sendCallbackWithAuthorize: 'whether you want oauth_callback=... as a query param send with your request to /oauth/authorize'
    , consumerKey: 'the api key provided by the OAuth provider'
    , consumerSecret: 'the api secret provided by the OAuth provider'
    , myHostname: 'e.g., http://localhost:3000 . Notice no trailing slash'
4

1 回答 1

0

所以我能够通过查看https://github.com/paullang/express-angular/commit/e224e7296436f1a1a2851b50212b27b66d7adc31来弄清楚

并替换:

everyauth
    .twitter
    .consumerKey(process.env.TWITTER_CONSUMER_KEY)
    .consumerSecret(process.env.TWITTER_CONSUMER_SECRET)

和:

everyauth
    .twitter
    .consumerKey('JLCGyLzuOK1BjnKPKGyQ')
    .consumerSecret('GNqKfPqtzOcsCtFbGTMqinoATHvBcy1nzCTimeA9M0')

在 app.js 中,现在它可以工作了!

于 2013-10-26T17:38:53.233 回答