Wt+OAuth2+FastCGI = empty popup after confirming consent screen
Added by Dawid Oriański over 9 years ago
Hi!
While looking for good framework for web tool development, Wt piqued my interest. I need a Google OAuth login feature though and couldn't make it run with nginx and spawn-fcgi.
I looked at the code and I think I know the reason, but would rather developers to verify this. I'll use current master (commit 297fdc73a348b62082f3d976531f815ae68d5488) from https://github.com/kdeforche/wt as sources reference.
First, let me show you an excerpt from WResource.C (starting from line 213)
if (!continuation)
response.setStatus(200);
handleRequest(request, response);
Then an excerpt from FCGIStream.C, FCGIRequest (starting line 100)
virtual void setStatus(int status)
{
*out_ << "Status: " << status << "\r\n";
}
And finally an excerpt from OAuthService.C, OAuthService::Impl::RedirectEndpoint (starting line 513)
response.setStatus(302);
response.addHeader("Location", redirectUrl);
return;
When OAuth code is sent from Google, handling takes place. It should result in redirect and seems to look like that:
- Create an FCGIRequest
- Enter WResource handler (excerpt 1), where it sets status to 200
- FCGIRequest appends it to the stream (excerpt 2)
- Then RedirectEndpoint handler is called, where it sets status to 302 (excerpt 3)
- FCGIRequest appends it to the stream (excerpt 2)
- Two status codes are present in serialization.
At least in nginx only first one is taken into consideration, so all WResources always return 200.
Could someone look into it, please?
Replies (4)
RE: Wt+OAuth2+FastCGI = empty popup after confirming consent screen - Added by Koen Deforche over 9 years ago
That's clearly a bug, I filled a ticket: #4341
RE: Wt+OAuth2+FastCGI = empty popup after confirming consent screen - Added by Dawid Oriański over 9 years ago
Thanks! Looking forward to seeing it fixed.
Great job btw. The more I learn WT the greater it seems ;)
RE: Wt+OAuth2+FastCGI = empty popup after confirming consent screen - Added by Benoit Daccache over 9 years ago
Hey Dawid,
The following patch seems to fix the problem.
Can you test it and see if it works also for you ?
Regards,
Benoit
RE: Wt+OAuth2+FastCGI = empty popup after confirming consent screen - Added by Dawid Oriański about 9 years ago
Hey Bonoit,
Sorry for the long delay - I had quite some crunching at work.
I have just built wt 3.3.4 with patch applied and indeed OAuth authorization works!
Thank you very much!