Important: Please read the Qt Code of Conduct -

Open URL with js like window in user's default browser?

  • I am trying to program with QOAuth2AuthorizationCodeFlow. From demos the authorization is performed by

        connect(ptrToQOAuth, &QOAuth2AuthorizationCodeFlow::authorizeWithBrowser, &QDesktopServices::openUrl);

    which will open user's default browser for the authorization page.
    However, this has two problems:

    1. I lose control of the opened webpage and cannot close it after authorization finished. JS code window.close in the redirected page cannot close the page in many browsers for security reason.
    2. The page becomes a tab in the browser rather than a popup window.

    One possibility is to open a widget with QWebView and close the window when from QOAuth2AuthorizationCodeFlow class when it receives relevant signals.

    But is there anyway that we can open a popup window with the authorization page, something like js, with user's default browser rather than another Qt Widget, so that OAuth2 provider can use user's cookie.

Log in to reply