Ditto
1.0.14
|
Provides access to authentication information and methods for logging on to Ditto Cloud. Relevant when using an OnlineWithAuthentication
or an Online
identity.
More...
Public Member Functions | |
void | login_with_token (std::string token, std::string provider, std::function< void(std::unique_ptr< DittoError >)> login_handler) |
Log in to Ditto with a third-party token. More... | |
void | login_with_credentials (std::string username, std::string password, std::string provider, std::function< void(std::unique_ptr< DittoError >)> login_handler) |
Log in to Ditto with a username and password. More... | |
bool | is_authenticated () |
std::string | user_id () |
Provides access to authentication information and methods for logging on to Ditto Cloud. Relevant when using an OnlineWithAuthentication
or an Online
identity.
bool ditto::Authenticator::is_authenticated | ( | ) |
Query whether Ditto has a valid authentication token.
This will only be true
when using an OnlineWithAuthentication
or an Online
identity, after a successful login. If the authentication token is allowed to expire then it will return false
instead.
void ditto::Authenticator::login_with_credentials | ( | std::string | username, |
std::string | password, | ||
std::string | provider, | ||
std::function< void(std::unique_ptr< DittoError >)> | login_handler | ||
) |
Log in to Ditto with a username and password.
[in] | username | the username component of the credentials used for log in. |
[in] | password | the password component of the credentials used for log in. |
[in] | provider | the name of the authentication provider. |
[in] | login_handler | a lambda that will get called when the login attempt has completed. |
void ditto::Authenticator::login_with_token | ( | std::string | token, |
std::string | provider, | ||
std::function< void(std::unique_ptr< DittoError >)> | login_handler | ||
) |
std::string ditto::Authenticator::user_id | ( | ) |
Return the currently logged-in user ID.
This will return the empty string if there is no valid authentication or OnlineWithAuthentication
/Online
mode is not being used.