QOAuth2AuthorizationCodeFlow fails without message. How to debug?
-
Hi,
I am trying to connect with the digikey webshop though my application. It worked very well for months until now. I didn't even recompiled the binary, so I don't know what changed, whether it was the shop or maybe an windows-update interfered in the past.
Some Facts:
Digikey: https://developer.digikey.com/documentation/oauth
Tried with Qt 5.14.2(windows) and 5.12.8(linux)Logging is activated:
QLoggingCategory::setFilterRules("qt.networkauth.*=true");
Now when I call the function grant():
DigikeyWrapper::DigikeyWrapper(const Settings &settings, QObject *parent) : QObject(parent) , m_settings(settings) { auto replyHandler = new QOAuthHttpServerReplyHandler(1337, this); oauth2.setReplyHandler(replyHandler); oauth2.setAuthorizationUrl(QUrl(m_settings.get_digikey_url_string() + "/v1/oauth2/authorize")); oauth2.setAccessTokenUrl(QUrl(m_settings.get_digikey_url_string() + "/v1/oauth2/token")); oauth2.setScope("identity read"); oauth2.setClientIdentifier(m_settings.get_digikey_clientID()); oauth2.setClientIdentifierSharedKey(m_settings.get_digikey_secret()); network_manager = new QNetworkAccessManager(this); connect(&oauth2, &QOAuth2AuthorizationCodeFlow::statusChanged, [=](QAbstractOAuth::Status status) { qDebug() << "statusChanged"; if (status == QAbstractOAuth::Status::Granted) emit authenticated(); }); oauth2.setModifyParametersFunction([&](QAbstractOAuth::Stage stage, QVariantMap *parameters) { if (stage == QAbstractOAuth::Stage::RequestingAuthorization && isPermanent()) parameters->insert("duration", "permanent"); }); connect(&oauth2, &QOAuth2AuthorizationCodeFlow::authorizeWithBrowser, &QDesktopServices::openUrl); connect(this, &DigikeyWrapper::authenticated, this, &DigikeyWrapper::just_authenticated); } void DigikeyWrapper::grant() { qDebug() << "granting.."; oauth2.grant(); }
The browser window opens but is completely empty. Normally I should see a mask to enter my shop credentials.
The console says:granting.. qt.networkauth.oauth2: Generated URL: https://api.digikey.com/v1/oauth2/authorize?client_id=xxxxxxxx&redirect_uri=http://127.0.0.1:1337/&response_type=code&scope=identity read&state=8E4ntqBX onecore\com\combase\catalog\catalog.cxx(1026)\combase.dll!00007FF94979A4F6: (caller: 00007FF9497B9472) ReturnHr(1) tid(2500) 80070716 Der angegebene Ressourcenname wurde nicht in der Image-Datei gefunden. onecore\com\combase\inc\ComCatalogHelpers.hpp(60)\combase.dll!00007FF9497B94F9: (caller: 00007FF9497B7FF8) ReturnHr(2) tid(2500) 80070716 Der angegebene Ressourcenname wurde nicht in der Image-Datei gefunden.
If I try the same interface from a python program everything works as expected. This confirms that Digikey is still working.
Unfortunately I don't get any error message except the combase.dll errors where i don't have any clue what this means. Do you have any idea how to debug that issue?
Thank you for ideas,
Aphot -
Hi and welcome to devnet,
What about the error message on Linux ?
-
Hi,
its been i while i didnt work on the project. The branch I use on linux generates mostly the same log:
granting.. qt.networkauth.oauth2: Generated URL: https://api.digikey.com/v1/oauth2/authorize?client_id=xxx&redirect_uri=http://127.0.0.1:1337/&response_type=code&scope=identity read&state=zNpwF7xT
I also checked the empty page i get from Digikey, where I should see the logingscreen, and also the html souce code is empty.
-
Do you mean the login page is empty ?
-
Authentication is sometime mysterious...