Login Via POST

look at your network tab when you click the join button, you'll see the POST with the data it sends, the response has a Set-Cookie header
17 Replies
Ethck
Ethckβ€’3y ago
So @kakaroto I've found a POST to the /join endpoint and tested that I can get the same parameters back. I tested via manually sending POST from my browser but it didn't take me into the game world. Am I missing something? Thanks for all the help btw!
Leo The League Lion
Leo The League Lionβ€’3y ago
@ethck gave vote LeaguePointsβ„’ to @kakaroto (#12 β€’ 133)
KaKaRoTo πŸ‰
KaKaRoTo πŸ‰β€’3y ago
The POST wouldn't take you into the world, it would just authenticate you, I think the response also has a Location: header for where you'd be redirected (/game basically) it's not very complicated.. as long as you know the user/pass to login with πŸ™‚ And that's the complicated part, especially since they're hashed now in 0.8.7+
Ethck
Ethckβ€’3y ago
So in the response I see a redirect: "/game" but no Location header.
KaKaRoTo πŸ‰
KaKaRoTo πŸ‰β€’3y ago
for integration with something else, I'm not sure how that would work though 😬
Ethck
Ethckβ€’3y ago
I can figure that part out (eventually) But that won't get far if I can't get into foundry without manually clicking join 🀣
KaKaRoTo πŸ‰
KaKaRoTo πŸ‰β€’3y ago
humm, yeah, no location in the response πŸ€·β€β™‚οΈ
Ethck
Ethckβ€’3y ago
So do I just get the game page and attach the cookie?
KaKaRoTo πŸ‰
KaKaRoTo πŸ‰β€’3y ago
1sec I'll open vscode and check
Ethck
Ethckβ€’3y ago
Thanks!
KaKaRoTo πŸ‰
KaKaRoTo πŸ‰β€’3y ago
yeah, I manually redirect it the /join handler :
const setCookie = await userManager.login(req.user, req.query.as);
if (setCookie) {
res.append('Set-Cookie', setCookie)
return res.redirect("/game");
}
const setCookie = await userManager.login(req.user, req.query.as);
if (setCookie) {
res.append('Set-Cookie', setCookie)
return res.redirect("/game");
}
Ethck
Ethckβ€’3y ago
Thanks so much! This will be the first step, but it was likely the primary blocker lol (Pinging just to give you points) @kakaroto
Leo The League Lion
Leo The League Lionβ€’3y ago
@ethck gave vote LeaguePointsβ„’ to @kakaroto (#11 β€’ 134)
KaKaRoTo πŸ‰
KaKaRoTo πŸ‰β€’3y ago
Points! 😍 no problem, good luck!
Ethck
Ethckβ€’3y ago
Thanks, if it goes well there will be more than a few integrations lol (I've got LDAP in my stack... so... let the nightmares begin)
KaKaRoTo πŸ‰
KaKaRoTo πŸ‰β€’3y ago
😱 yeah... that sounds fun, lol
Ethck
Ethckβ€’3y ago
pretty much thisisfine