liamcurry / passport-steam

Steam (OpenID) authentication strategy for Passport and Node.js.
MIT License
349 stars 104 forks source link

Unable to pass req.isAuthenticated() check in backend api #122

Open The-Lord-of-Owls opened 1 year ago

The-Lord-of-Owls commented 1 year ago

I'm currently working on a react project using a backend api running passport-steam. I'm running into the issue where none of my requests are actually comming back authorized. I'm wondering if you could help point ouf a problem in my code somewhere.

This is the code I'm using for the backend api. However in the frontend when trying to make the fallowing api request: https://pastebin.com/EjnvRpZQ

axios.get( "http://localhost:4000/api/authed" )

I get back the message: 'Unauthorized' that ensureAuthenticated is supposed to return if req.isAuthenticated() returns false. So right of the bat I know that the problem starts with isAuthenticated(), but I can't figure out what exactly I'm missing here in order to get authentication to work right for this

Bantorbann commented 1 year ago

to test it you have to put in your security key and other required login information

The-Lord-of-Owls commented 1 year ago

where exactly tho? Cause I've tried going off what was shown here https://www.passportjs.org/packages/passport-steam/

I click login on the front end, it then goes to /api/login for the backend, which then takes me to steam, I then get redirected back to / on the front end. But not authed.

The-Lord-of-Owls commented 1 year ago

do I need to provide something alongside axios.get and if so what am I providing and how do I get it onto the front end in the first place properly?