Skip to content

Commit

Permalink
[o2] A new refresh_token is not a mandatory part of the response
Browse files Browse the repository at this point in the history
after requesting a refresh

The server will always return a new access_token, but returning
a new refresh_token is optional
  • Loading branch information
nyalldawson committed May 12, 2019
1 parent 152a556 commit ba8f8e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion external/o2/src/o2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,9 @@ void O2::onRefreshFinished() {
QVariantMap tokens = parseTokenResponse(reply);
setToken(tokens.value(O2_OAUTH2_ACCESS_TOKEN).toString());
setExpires(QDateTime::currentMSecsSinceEpoch() / 1000 + tokens.value(O2_OAUTH2_EXPIRES_IN).toInt());
setRefreshToken(tokens.value(O2_OAUTH2_REFRESH_TOKEN).toString());
const QString refreshToken = tokens.value(O2_OAUTH2_REFRESH_TOKEN).toString();
if ( !refreshToken.isEmpty() )
setRefreshToken(refreshToken);
timedReplies_.remove(refreshReply);
setLinked(true);
Q_EMIT linkingSucceeded();
Expand Down

0 comments on commit ba8f8e3

Please sign in to comment.