Project

General

Profile

Calling GoogleService using WidgetSet

Added by Alex Schulmann about 2 months ago

I have a WT application running on server A. Now I want to embed it into an HTML page running on server B. In scenario 1, I use a popup window; in scenario 2, I use WidgetSet. Everything works fine except for GoogleService in scenario 2. The Google popup window appears, and I can enter credentials, but the redirection back to my embedded app doesn’t seem to work. Both servers are running on HTTPS and are set as authorized sources in the Google Console. Any ideas? Thanks!


Replies (2)

RE: Calling GoogleService using WidgetSet - Added by Matthias Van Ceulebroeck about 2 months ago

Hi Alex,

do you get a log entry in your widget set app when the redirect happens, or not? Then perhaps it's just a matter of ensuring the redirect endpoint is correctly set in the configuration/code.

I imagine that, due to the two applications (the real application, and the widgetset) having two different entrypoints, you'll need to have two sets of configuration for the wt_config.xml, or have a branch in the OAuth client to ensure that GoogleService::setRedirectEndpoint() has a logic branch to take this into account.
Let me know if that works or not!

Best,
Matthias

RE: Calling GoogleService using WidgetSet - Added by Alex Schulmann about 2 months ago

Hi Matthias,

you are absolutely right, the problem is the redirection endpoint. But how to set it correctly? When I use

server.addEntryPoint(Wt::EntryPointType::WidgetSet, [](const Wt::WEnvironment &env) { return std::make_unique<App>(env, true); }, "/script.js");

I see

/script.js/oauth2callback?state=SUF... and
...
/script.js?wtd=pBKTaBlwy....

in the log-file. I would expect https://domain.com/script.js/oauth2callback to be the right endpoint, but after (supposedly) successful login just an empty popup window from google auth appears and no redirection happens.

    (1-2/2)