private/RequestHandlerPrivate.cpp
/** ************************************************************************************************
    * @brief        Function called when a reply is received after calling refreshToken().
    ***************************************************************************************************/
@brief        Function called when a reply is received after calling refreshToken().
@brief Function called when a reply is received after calling refreshToken () .
void RequestHandlerPrivate::onRefreshTokenReplyReceived()
    {
        if (QNetworkReply *reply = qobject_cast<QNetworkReply*>(QObject::sender()))
        {
            if (reply->error() != QNetworkReply::NoError)
            {
                handleAuthenticationError(ErrorContext::Context_RefreshTokenReply, reply->readAll());
            }
            else
            {
                m_authManager->setToken(QJsonDocument::fromJson(reply->readAll()).object()["access_token"].toString());
                emit tokenRefreshed(m_authManager->refreshToken());
                m_tokenRefreshTimer.start();
            }
            reply->deleteLater();
        }
        m_lastTokenRefresh = std::chrono::system_clock::now();
    }
void RequestHandlerPrivate :: onRefreshTokenReplyReceived ( ) { if ( QNetworkReply * reply = qobject_cast < QNetworkReply * > ( QObject :: sender ( ) ) ) { if ( reply -> error ( ) != QNetworkReply :: NoError ) { handleAuthenticationError ( ErrorContext :: Context_RefreshTokenReply , reply -> readAll ( ) ) ; } else { m_authManager -> setToken ( QJsonDocument :: fromJson ( reply -> readAll ( ) ) . object ( ) [ " " ] . toString ( ) ) ; emit tokenRefreshed ( m_authManager -> refreshToken ( ) ) ; m_tokenRefreshTimer . start ( ) ; } reply -> deleteLater ( ) ; } m_lastTokenRefresh = std :: chrono :: system_clock :: now ( ) ; }
@brief        Function called when a reply is received after calling refreshToken().
@brief Function called when a reply is received after calling refreshToken () .
// Refresh the token later.