【问题标题】:500 Error when hitting route /api/profile/twitter for IBM Watson Personality Insights application为 IBM Watson Personality Insights 应用程序点击路由 /api/profile/twitter 时出现 500 错误
【发布时间】:2016-11-21 19:04:23
【问题描述】:

我已经分叉并克隆了这个 repo:https://github.com/watson-developer-cloud/personality-insights-nodejs

我已经在credentials.json 文件中添加了我的消费者密钥和秘密,就像它在README 中所述,但我得到了500 Error。我认为问题在于我需要包含我的访问令牌和访问令牌秘密,但不清楚我将在哪里包含它。

这是我得到的500 Error(注意:我替换了敏感路径和变量):

GET /auth/twitter? 302 227.700 ms - 0
error: Error: Failed to find request token in session
    at SessionStore.get (/project/node_modules/passport-oauth1/lib/requesttoken/session.js:13:44)
    at Strategy.OAuthStrategy.authenticate (/project/node_modules/passport-oauth1/lib/strategy.js:214:33)
    at Strategy.authenticate (/project/node_modules/passport-twitter/lib/strategy.js:87:40)
    at attempt (/project/node_modules/passport/lib/middleware/authenticate.js:348:16)
    at authenticate (/project/node_modules/passport/lib/middleware/authenticate.js:349:7)
    at Layer.handle [as handle_request] (/project/node_modules/express/lib/router/layer.js:95:5)
    at next (/project/node_modules/express/lib/router/route.js:131:13)
    at Route.dispatch (/project/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/project/node_modules/express/lib/router/layer.js:95:5)
    at /project/node_modules/express/lib/router/index.js:277:22
    at Function.process_params (/project/node_modules/express/lib/router/index.js:330:12)
    at next (/project/node_modules/express/lib/router/index.js:271:10)
    at Function.handle (/project/node_modules/express/lib/router/index.js:176:3)
    at router (/project/node_modules/express/lib/router/index.js:46:12)
    at Layer.handle [as handle_request] (/project/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/project/node_modules/express/lib/router/index.js:312:13) 'url:' '/auth/twitter/callback?oauth_token=SOME_TOKEN&oauth_verifier=SOME_VERIFIER' 'Error:' code=500, code=undefined, error=undefined
GET /auth/twitter/callback?oauth_token=SOME_TOKEN&oauth_verifier=SOME_VERIFIER 500 6.464 ms - 23

当我尝试访问他人的推文没有 Oauth 时,我也会收到401 Error,特别是我收到此错误:

error: { code: 401,
error: 'Unauthorized: Access is denied due to invalid credentials' }     'url:' '/api/profile/twitter' 
'Error:' code=401, code=401, error=There was a problem processing the personality. Please check your credentials. 

【问题讨论】:

    标签: ibm-watson personality-insights


    【解决方案1】:

    您确定您在 Twitter 通话中收到了 401 吗?设置 Twitter 访问权限的说明在您提供的链接中的“设置 Twitter 应用程序”标题下的存储库说明中。

    【讨论】:

    • 您好,谢谢您的回复。我再次检查,似乎在实际尝试登录 Twitter 并获取/发布我的推文时出现 500 错误,而当我阅读其他人的推文时出现 401 错误(我自己没有登录)。我阅读了自述文件中的说明,但仍然遇到此问题。
    • 如果您已经注册了 twitter 回调(对于 Bluemix 环境:.mybluemix.net/auth/twitter/callback),那么您不需要将访问令牌提供为它正在通过誓言处理(github.com/watson-developer-cloud/personality-insights-nodejs/…
    • 谢谢,这是有道理的。我已经注册了回调(虽然本地环境之一:server.local:3000/auth/twitter/callback),但它仍然给我一个 500 错误。还有其他原因吗?
    • 还有'(一定要配置hosts文件,使server.local指向127.0.0.1)'
    猜你喜欢
    • 1970-01-01
    • 2020-05-13
    • 1970-01-01
    • 2021-06-08
    • 2018-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多