Ditto 1.1.7
Public Member Functions | List of all members
ditto::AuthenticationCallback Class Referenceabstract

Provides feedback to the developer about Ditto authentication status. More...

#include <AuthenticationCallback.hpp>

Public Member Functions

virtual void authentication_required (std::shared_ptr< Authenticator > authenticator)=0
 There is no Ditto authentication token or it has expired. Sync will not work until there is a successful login using one of the login methods on Authenticator.
 
virtual void authentication_expiring_soon (std::shared_ptr< Authenticator > authenticator, std::int64_t seconds_remaining)=0
 Warns that the Ditto authentication token is getting old. More...
 
virtual void authentication_status_did_change (std::shared_ptr< Authenticator > authenticator)=0
 Notifies the callback object that the authentication status did change. Use the authenticators property status to query for the current authentication status.
 

Detailed Description

Provides feedback to the developer about Ditto authentication status.

Member Function Documentation

◆ authentication_expiring_soon()

virtual void ditto::AuthenticationCallback::authentication_expiring_soon ( std::shared_ptr< Authenticator authenticator,
std::int64_t  seconds_remaining 
)
pure virtual

Warns that the Ditto authentication token is getting old.

Ditto will attempt to refresh tokens periodically, starting from halfway through the token's validity period. This reduces the risk of authentication expiring while the user is offline.

The refresh will happen automatically if Ditto has a suitable refresh token. If new credentials are required, such as a third-party token or a username/password, then Ditto does not cache that information and you must submit it again using one of the login methods on Authenticator.