jaredhanson/passport-twitter

Error: Failed to find request token in session

vaibhavarora14 opened this issue · 2 comments

** READ THIS FIRST! **

Are you looking for help?

No, I am certain about issue

In Twitter callback request, the server gives an error of "500: Error: Failed to find request token in session"
OAuth token is definitely returning by Twitter in query params, but request comes as new (I compare request-id and details), and session object I see as reset.

I am trying to get the OAuth token for users which is provided by Twitter.

Expected behavior

It should be able to identify OAuth token sent back by Twitter in query params, and continue further?

Actual behavior

As far as I have understood, if the concept of session forwarding, URLs are the same as localhost, so I am not sure why the session is losing out when /callback request comes.
But because of this, it's breaking in code.

Screenshot of code when session is getting updated with oauthtoken -
image

Next thing I see in callback call, request is passed with new session object -
image

Steps to reproduce

Run https://github.com/VB-Inc/rise-in-social-backend locally

// Format code using Markdown code blocks

Environment

  • Operating System: MacOS
  • Node version: 14.18.1
  • "fastify": "3.24.1",
  • "fastify-passport": "^0.4.3",
  • "fastify-secure-session": "^3.0.0",
  • "passport": "^0.5.0",
  • "passport-twitter": "^1.0.4"

The same thing, I checked in express server with express-session also.
Looks like we will have to go back to update session again from Twitter callback query Params