Skip to content

Commit

Permalink
Fix expiry message
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 18, 2024
1 parent 5efb9ab commit 3145b44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/o2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,8 @@ void O2::onRefreshFinished() {
else
{
setToken(tokens.value(O2_OAUTH2_ACCESS_TOKEN).toString());
setExpires(QDateTime::currentMSecsSinceEpoch() / 1000 + static_cast<qint64>(tokens.value(O2_OAUTH2_EXPIRES_IN).toInt()));
const int expiresIn = tokens.value(O2_OAUTH2_EXPIRES_IN).toInt();
setExpires(QDateTime::currentMSecsSinceEpoch() / 1000 + static_cast<qint64>(expiresIn));
QString refreshToken = tokens.value(O2_OAUTH2_REFRESH_TOKEN).toString();
if(!refreshToken.isEmpty()) {
setRefreshToken(refreshToken);
Expand All @@ -608,7 +609,7 @@ void O2::onRefreshFinished() {
setLinked(true);
Q_EMIT linkingSucceeded();
Q_EMIT refreshFinished(QNetworkReply::NoError);
log( QStringLiteral(" New token expires in %1 seconds").arg( expires() ) );
log( QStringLiteral(" New token expires in %1 seconds").arg( expiresIn ) );
}
} else {
log( QStringLiteral( "O2::onRefreshFinished: Error %1 %2" ).arg( (int)refreshReply->error() ).arg( refreshReply->errorString() ) );
Expand Down

0 comments on commit 3145b44

Please sign in to comment.