summaryrefslogtreecommitdiffstats
path: root/src/oauth/qoauth2authorizationcodeflow.cpp
diff options
context:
space:
mode:
authorMagdalena Stojek <magdalena.stojek@qt.io>2024-11-25 12:38:30 +0100
committerJuha Vuolle <juha.vuolle@qt.io>2024-12-10 09:36:45 +0200
commit70ddd6b3e059e075a8ae9eb307f8573a9dcc3d7e (patch)
treef34f005fa9573e45cbaf6cd2333ba649eea0fc84 /src/oauth/qoauth2authorizationcodeflow.cpp
parentf7193bc5853238da26717dbd8ab926d731b20faf (diff)
Add token expiration convenience to Device Flow class
Add automatic token refresh for expiring tokens in Device Flow class, if a refresh token is available. This functionality, previously implemented in Authorization Code Flow class, has now been extended to Device Flow following its merge. Add additional check for QOAuth2AuthorizationCodeFlow preventing unintened automatic refresh attempts. Pick-to: 6.9 Task-number: QTBUG-130844 Change-Id: I175abd0769d60d5440a3e84dc57d6f3d00193e41 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/oauth/qoauth2authorizationcodeflow.cpp')
-rw-r--r--src/oauth/qoauth2authorizationcodeflow.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/oauth/qoauth2authorizationcodeflow.cpp b/src/oauth/qoauth2authorizationcodeflow.cpp
index c707703..11583e0 100644
--- a/src/oauth/qoauth2authorizationcodeflow.cpp
+++ b/src/oauth/qoauth2authorizationcodeflow.cpp
@@ -177,7 +177,8 @@ void QOAuth2AuthorizationCodeFlowPrivate::initializeAutoRefresh()
{
Q_Q(QOAuth2AuthorizationCodeFlow);
QObject::connect(q, &QAbstractOAuth2::accessTokenAboutToExpire, q, [q] {
- if (q->autoRefresh() && !(q->refreshToken().isEmpty()))
+ if (q->autoRefresh() && !(q->refreshToken().isEmpty())
+ && (!(q->status() == QOAuth2AuthorizationCodeFlow::Status::RefreshingToken)))
q->refreshAccessToken();
});
}