Remove some params when refreshing token.

This commit is contained in:
Martin Rotter 2017-09-24 22:39:25 +02:00
parent 3457549e45
commit bba41c5e60
2 changed files with 16 additions and 1 deletions

View File

@ -844,3 +844,10 @@ mac {
misc_icon misc_plain_icon misc_texts translations
}
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../build-qtnetworkauth-Desktop-Debug/lib/release/ -lQt5NetworkAuth
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../build-qtnetworkauth-Desktop-Debug/lib/debug/ -lQt5NetworkAuth
else:unix: LIBS += -L$$PWD/../build-qtnetworkauth-Desktop-Debug/lib/ -lQt5NetworkAuth
INCLUDEPATH += $$PWD/../build-qtnetworkauth-Desktop-Debug/include
DEPENDPATH += $$PWD/../build-qtnetworkauth-Desktop-Debug/include

View File

@ -57,7 +57,9 @@ void InoreaderNetworkFactory::setBatchSize(int batch_size) {
}
void InoreaderNetworkFactory::logIn() {
if (!m_oauth2->expirationAt().isNull() && m_oauth2->expirationAt() <= QDateTime::currentDateTime() && !m_refreshToken.isEmpty()) {
if (!m_oauth2->expirationAt().isNull() &&
m_oauth2->expirationAt() <= QDateTime::currentDateTime() &&
!m_refreshToken.isEmpty()) {
// We have some refresh token which expired.
m_oauth2->refreshAccessToken();
}
@ -106,6 +108,12 @@ void InoreaderNetworkFactory::initializeOauth() {
connect(oauth_reply_handler, &QOAuthHttpServerReplyHandler::tokensReceived, this, &InoreaderNetworkFactory::tokensReceived);
m_oauth2->setModifyParametersFunction([&](QAbstractOAuth::Stage stage, QVariantMap* parameters) {
qDebug() << "Inoreader: Set modify parameters for stage" << (int)stage << "called: \n" << parameters;
if (stage == QAbstractOAuth::Stage::RefreshingAccessToken) {
parameters->insert(QSL("client_id"), INOREADER_OAUTH_CLI_ID);
parameters->insert(QSL("client_secret"), INOREADER_OAUTH_CLI_KEY);
parameters->remove(QSL("redirect_uri"));
}
});
connect(m_oauth2, &QOAuth2AuthorizationCodeFlow::granted, [=]() {
qDebug("Inoreader: Oauth2 granted.");