Getting feedback from the web browser once a user has authorised an OAuth token
I’m currently implementing an OAuth authentication system in my app using a third-party QOauth [github.com] library. I’m trying to figure out how to get feedback from the browser that will let me know that the user has either authorised the token or cancelled the process.
So far, I can only think of starting a timer as soon as the user presses the “Authorise” button that will open their browser at the service’s authorisation page using QDesktopServices::openUrl, and pinging the service once every 4 seconds for a minute to see if the token has been authorised. While this would work, It’s not very nice and I was wondering if anyone could come up with a better solution since this one would rely on using QTimer and that doesn’t seem to be completely reliable [qt-project.org].
I was hoping to be able to use something akin to a Signal/Slot operation, but since the browser is an external app, I have no idea how to tap into it. I also can’t rely on the starting and stopping of the browser’s process to indicate what’s going on since the user having the browser already open will throw that right off.