7#include <albert/export.h>
18class ALBERT_EXPORT
OAuth2 :
public QObject
85 const QString &refresh_token = {},
86 const QDateTime &expiration = {});
117 std::unique_ptr<Private> d;
Provides OAuth2 authentication with support for the Authorization Code Flow with PKCE and refresh tok...
Definition oauth.h:19
bool isPkceEnabled() const
Returns true if PKCE is enabled, false otherwise.
void scopeChanged(const QString &)
Emitted when the scope changes.
void tokensChanged()
Emitted when the access token, refresh token or expiration date changes.
const QString & scope() const
Returns the OAuth scope to request permissions for.
void setScope(const QString &scope)
Sets the OAuth scope to request permissions for to scope.
const QString & tokenUrl() const
Returns the token URL.
const QString & clientSecret() const
Returns the client secret.
void updateTokens()
Updates the access token.
const QString & clientId() const
Returns the client identifier.
void setTokenUrl(const QString &url)
Sets the token URL to url.
void handleCallback(const QUrl &callback)
Handles the redirect callback URL from the OAuth2 provider.
void requestAccess()
Requests access, i.e. starts the Authorization Code Flow to obtain an access token.
State
Definition oauth.h:91
void setTokens(const QString &access_token, const QString &refresh_token={}, const QDateTime &expiration={})
Sets the access token, refresh token and expiration date.
void authUrlChanged(const QString &)
Emitted when the authorization URL changes.
void clientSecretChanged(const QString &)
Emitted when the client secret changes.
const QString & error() const
Returns the error message if any.
const QString & redirectUri() const
Returns the redirect URI.
const QString & refreshToken() const
Returns the access token.
void stateChanged(State)
Emitted when the state changes.
const QString & authUrl() const
Returns the authorization URL.
void setAuthUrl(const QString &url)
Sets the authorization URL to url.
void setClientId(const QString &id)
Sets the client identifier to id.
void setPkceEnabled(bool enabled)
Sets whether PKCE is enabled or not.
void setClientSecret(const QString &secret)
Sets the client secret to secret.
void clientIdChanged(const QString &)
Emitted when the client ID changes.
void setRedirectUri(const QString &uri)
Sets the redirect URI to uri.
State state() const
Returns the state of the authorization flow.
void tokenUrlChanged(const QString &)
Emitted when the token URL changes.
const QString & accessToken() const
Returns the access token.
const QDateTime & tokenExpiration() const
Returns the access token.
void redirectUriChanged(const QString &)
Emitted when the redirect URI changes.
Definition backgroundexecutor.h:12