Reddit Example failing
-
Well, then something is broken in Qt. Because the
redirect_uridefinitely does not match what I set in my Reddit app. -
I'm still seeing this error in the output:
qt.networkauth.oauth2: Unexpected callBut it did succeed authenticating. I'm using Mingw.
OK, so this at least works on Windows. Now to make it work on WSL2/Linux.@HappyCerberus Please note that openSSL redistributed with Qt is for MSVC only. For use with MinGW you'd need to find precompiled binaries build with MinGW, version 1.1.1.4 (or 1.1.1.d), respectively x86 or x64. Or build them yourself.
-
@artwaw So, what you are saying is that the single case that I actually managed to get working is one that should not work :-D This is getting better and better :-)
-
@artwaw So, what you are saying is that the single case that I actually managed to get working is one that should not work :-D This is getting better and better :-)
@HappyCerberus It is a bit of a mystery for me too :) But I learned the hard way the first time they included OpenSSL in Qt and since then I don't rely this particular source.
-
@artwaw So, what you are saying is that the single case that I actually managed to get working is one that should not work :-D This is getting better and better :-)
@HappyCerberus I've de-dusted my old problems I had with SSL supplied via onlineinstaller - here goes the summary:
- I compile with MinGW on Windows. Always have been.
- once OpenSSL became available I was very happy, since it should simplify things. I began to use it but users reported to me that on some machines it doesn't work.
- I've spent quite some time debugging until I took a look into libraries provided. They're compiled with MSVC so they need MSVC libraries to run. If you have them installed, everything will work just fine. So if it worked, it worked but some of my users have not had those libs installed.
- Since then I stopped using bundled OpenSSL, as it is just potential additional overhead and more dependencies.
So if it worked for you, you simply had those Microsoft runtime libraries installed. But I'd check with dependency free MinGW compiled SSL libs too, just to be sure.
-
@artwaw Yeah, my problem now is that it doesn't work on Linux, and I suspect that it will not work because of the
redirect_uri. -
@artwaw Yeah, my problem now is that it doesn't work on Linux, and I suspect that it will not work because of the
redirect_uri.@HappyCerberus That's beyond my area of experience, I am afraid. Hopefully more experienced colleagues here can be of help.
-
Do you get the same issue with a "classic" Linux rather than WSL2 ?
-
Yeah, unfortunately the
redirect_uriis again wrong and when I manually change it I get:qt.networkauth.oauth2: Unexpected call qt.networkauth.oauth2: Error: invalid_grant -
I was having the same problem.
I had to manually set the
redirect_urifor theRequestingAuthorizationstage to just get that first part to work.After that I get the same
invalid_granterror.The reddit api says that you get this error if you use an expired code, or reuse a code. Apparently though, you also get it if the
redirect_uris in both theRequestingAuthorizationstage and theRequestingAccessTokenstage don't match.oauth2.setModifyParametersFunction([&](QAbstractOAuth::Stage stage, QVariantMap *parameters) { if(stage == QAbstractOAuth::Stage::RequestingAuthorization) { parameters->insert("duration", "permanent"); parameters->insert("redirect_uri", QByteArray("http://127.0.0.1:1337")); } else if(stage == QAbstractOAuth::Stage::RequestingAccessToken) { parameters->insert("redirect_uri", QByteArray("http://127.0.0.1:1337")); } });That seems to have worked.