|
Albert
|
#include <albert/oauth.h>
Provides OAuth2 authentication with support for the Authorization Code Flow with PKCE and refresh tokens.
See also OAuthConfigWidget.
Inherits QObject.
Public Types | |
| enum class | State |
Public Member Functions | |
| OAuth2 () | |
| Constructs an OAuth2. | |
| ~OAuth2 () | |
| Destruct the OAuth2. | |
| void | requestAccess () |
| Requests access, i.e. | |
| void | updateTokens () |
| Updates the access token. | |
| const QString & | clientId () const |
| Returns the client identifier. | |
| void | setClientId (const QString &id) |
| Sets the client identifier to id. | |
| const QString & | clientSecret () const |
| Returns the client secret. | |
| void | setClientSecret (const QString &secret) |
| Sets the client secret to secret. | |
| 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 & | authUrl () const |
| Returns the authorization URL. | |
| void | setAuthUrl (const QString &url) |
| Sets the authorization URL to url. | |
| const QString & | redirectUri () const |
| Returns the redirect URI. | |
| void | setRedirectUri (const QString &uri) |
| Sets the redirect URI to uri. | |
| bool | isPkceEnabled () const |
| Returns true if PKCE is enabled, false otherwise. | |
| void | setPkceEnabled (bool enabled) |
| Sets whether PKCE is enabled or not. | |
| const QString & | tokenUrl () const |
| Returns the token URL. | |
| void | setTokenUrl (const QString &url) |
| Sets the token URL to url. | |
| const QString & | accessToken () const |
| Returns the access token. | |
| const QString & | refreshToken () const |
| Returns the access token. | |
| const QDateTime & | tokenExpiration () const |
| Returns the access token. | |
| void | setTokens (const QString &access_token, const QString &refresh_token={}, const QDateTime &expiration={}) |
| Sets the access token, refresh token and expiration date. | |
| const QString & | error () const |
| Returns the error message if any. | |
| State | state () const |
| Returns the state of the authorization flow. | |
| void | handleCallback (const QUrl &callback) |
| Handles the redirect callback URL from the OAuth2 provider. | |
Signals | |
| void | clientIdChanged (const QString &) |
| Emitted when the client ID changes. | |
| void | clientSecretChanged (const QString &) |
| Emitted when the client secret changes. | |
| void | scopeChanged (const QString &) |
| Emitted when the scope changes. | |
| void | authUrlChanged (const QString &) |
| Emitted when the authorization URL changes. | |
| void | redirectUriChanged (const QString &) |
| Emitted when the redirect URI changes. | |
| void | tokenUrlChanged (const QString &) |
| Emitted when the token URL changes. | |
| void | tokensChanged () |
| Emitted when the access token, refresh token or expiration date changes. | |
| void | stateChanged (State) |
| Emitted when the state changes. | |
|
strong |
| void albert::OAuth2::requestAccess | ( | ) |
Requests access, i.e.
starts the Authorization Code Flow to obtain an access token.