summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--src/oauth/qabstractoauth2.cpp5
-rw-r--r--src/oauth/qabstractoauth2.h5
-rw-r--r--src/oauth/qoauth2authorizationcodeflow.cpp3
4 files changed, 12 insertions, 3 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 3da47d7..4e8b2ca 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -2,4 +2,4 @@ load(qt_build_config)
CONFIG += warning_clean
-MODULE_VERSION = 5.11.2
+MODULE_VERSION = 5.12.0
diff --git a/src/oauth/qabstractoauth2.cpp b/src/oauth/qabstractoauth2.cpp
index 3f1416c..a3cbc04 100644
--- a/src/oauth/qabstractoauth2.cpp
+++ b/src/oauth/qabstractoauth2.cpp
@@ -484,7 +484,10 @@ QString QAbstractOAuth2::refreshToken() const
void QAbstractOAuth2::setRefreshToken(const QString &refreshToken)
{
Q_D(QAbstractOAuth2);
- d->refreshToken = refreshToken;
+ if (d->refreshToken != refreshToken) {
+ d->refreshToken = refreshToken;
+ Q_EMIT refreshTokenChanged(refreshToken);
+ }
}
QT_END_NAMESPACE
diff --git a/src/oauth/qabstractoauth2.h b/src/oauth/qabstractoauth2.h
index 9262170..a5bdd02 100644
--- a/src/oauth/qabstractoauth2.h
+++ b/src/oauth/qabstractoauth2.h
@@ -52,6 +52,10 @@ class Q_OAUTH_EXPORT QAbstractOAuth2 : public QAbstractOAuth
NOTIFY clientIdentifierSharedKeyChanged)
Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged)
Q_PROPERTY(QDateTime expiration READ expirationAt NOTIFY expirationAtChanged)
+ Q_PROPERTY(QString refreshToken
+ READ refreshToken
+ WRITE setRefreshToken
+ NOTIFY refreshTokenChanged)
public:
explicit QAbstractOAuth2(QObject *parent = nullptr);
@@ -101,6 +105,7 @@ Q_SIGNALS:
void clientIdentifierSharedKeyChanged(const QString &clientIdentifierSharedKey);
void stateChanged(const QString &state);
void expirationAtChanged(const QDateTime &expiration);
+ void refreshTokenChanged(const QString &refreshToken);
void error(const QString &error, const QString &errorDescription, const QUrl &uri);
void authorizationCallbackReceived(const QVariantMap &data);
diff --git a/src/oauth/qoauth2authorizationcodeflow.cpp b/src/oauth/qoauth2authorizationcodeflow.cpp
index 5e95f7a..4c23c97 100644
--- a/src/oauth/qoauth2authorizationcodeflow.cpp
+++ b/src/oauth/qoauth2authorizationcodeflow.cpp
@@ -142,7 +142,8 @@ void QOAuth2AuthorizationCodeFlowPrivate::_q_accessTokenRequestFinished(const QV
int expiresIn = values.value(Key::expiresIn).toInt(&ok);
if (!ok)
expiresIn = -1;
- refreshToken = values.value(Key::refreshToken).toString();
+ if (values.value(Key::refreshToken).isValid())
+ q->setRefreshToken(values.value(Key::refreshToken).toString());
scope = values.value(Key::scope).toString();
if (accessToken.isEmpty()) {
qCWarning(loggingCategory, "Access token not received");