0

I have forked and cloned this repo: https://github.com/watson-developer-cloud/personality-insights-nodejs

I've added my Consumer Key & Secret in the credentials.json file like it states in the README but I'm getting a 500 Error. I think the issue is that I need to include my Access Token & Access Token Secret, but it's unclear where I would include that.

Here is the 500 Error I get (Note: I replaced the sensitive paths and variables) :

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

I also get a 401 Error when I am trying to access others' tweets without Oauth, specifically I get this 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. 
socialpiranha
  • 182
  • 1
  • 1
  • 10

1 Answers1

0

Are you sure that you are getting the 401 on the Twitter call? The instructions for setting up the Twitter access are in the instructions to the repo at the link you provide, under the heading 'Setting Up Twitter Application'.

chughts
  • 4,210
  • 2
  • 14
  • 27
  • Hi chughts, thanks for the reply. I checked again, and it seems that I'm getting a 500 error when actually trying to sign into Twitter and get/post my tweets & I'm getting a 401 error when I'm reading other's tweets (without signing in myself). I read the instructions in the README, but am still experiencing this issue. – socialpiranha Jul 19 '16 at 09:01
  • If you have registered the twitter call back (For Bluemix environment: .mybluemix.net/auth/twitter/callback), then you don't need to supply the access token as it is being handled by oath (in https://github.com/watson-developer-cloud/personality-insights-nodejs/blob/master/router/auth.js) – chughts Jul 19 '16 at 12:19
  • Thanks that makes sense. I have registered the callback (though the local environment one: http://server.local:3000/auth/twitter/callback), but it's still throwing me a 500 error. Any other reason why? – socialpiranha Jul 19 '16 at 16:12
  • and have you '(be sure to configure hosts file so server.local points 127.0.0.1)' – chughts Jul 20 '16 at 16:47