Oauth2 with code and token
-
I try to get the code from an API to request a token. I can't read out the code provided by the redirect url (with my qt app).
The browser opens and I can loging but afterwards the QT does not get the code and I cannot authenticate further. The code is based on the reddit example.
Might someone has an idea?
oauth2.setAuthorizationUrl(QUrl(".../oauth/authorize")); oauth2.setAccessTokenUrl(QUrl("..../oauth/token")); oauth2.setScope("READSYSTEM"); oauth2.setClientIdentifier("10ba4ca31a5344868b32fe3f36576e00"); oauth2.setClientIdentifierSharedKey("qX+JBXrc2973loCZ9HeZ0JP1P7QqyM9vCRwr9sBH/hI="); auto replyHandler = new myReplyHandler(this); oauth2.setReplyHandler(replyHandler);I have my own callback written for redirect url. I cannot use localhost for that specific application.
connect(&oauth2, &QOAuth2AuthorizationCodeFlow::statusChanged, [=]( QAbstractOAuth::Status status) { 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); oauth2->grant(); -
Hi and welcome to devnet,
Can you explain exactly what happens after you sign in successfully ?
-
When I have signed (on the authentication page) in and clicked on the captcha I will be redirected to the url where I can get the code. The code is there and I see the message in the browser. But I should receive it directly in my program parse it and further use for the oauth process.