verida / data-connector-server

1 stars 2 forks source link

Session data isn't being saved #60

Closed tahpot closed 7 months ago

tahpot commented 7 months ago

The connect() endpoint sets session data which is then accessed in the callback() endpoint.

However, as you can see when running the code, the session information isn't retained.

This is a problem as the redirect URL is specified in connect(), but then can't be used in callback() to redirect the user back to the relevant application that initiated the connect request.

Is there an issue with session config / initialization?

Steps to reproduce:

  1. Run the server (yarn run start)
  2. Hit the /connect endpoint (ie: http://localhost:5021/connect/discord?did=did:vda:mainnet:0xCDEdd96AfA6956f0299580225C2d9a52aca8487A&key=abc82b917d4f44708f35a618247e70d5243b1c66c0b60a939bca0bc67eadddef&redirect=http://localhost:3001/connections)
  3. Hit the /callback endpoint (ie: http://localhost:5021/callback/discord?code=abc123)
  4. See the console output on the server and you'll see the session data from /callback endpoint doesn't match /connect endpoint
InfiniteAengus commented 7 months ago

Session config and initialization is correct. The only mistake is you are using http://localhost:5021 for backend endpoint. You can see it's working by using http://127.0.0.1:5021 instead of localhost.

tahpot commented 7 months ago

Ah, you are correct.

Awesome, I'll update the README.md