QOAuth2AuthorizationCodeFlow Class | Qt Network Authorization (original) (raw)
The QOAuth2AuthorizationCodeFlow class provides an implementation of the Authorization Code Grant flow. More...
Member Function Documentation
Constructs a QOAuth2AuthorizationCodeFlow object with parent object parent.
[explicit]
QOAuth2AuthorizationCodeFlow::QOAuth2AuthorizationCodeFlow(QNetworkAccessManager *manager, QObject *parent = nullptr)
Constructs a QOAuth2AuthorizationCodeFlow object using parent as parent and sets manager as the network access manager.
QOAuth2AuthorizationCodeFlow::QOAuth2AuthorizationCodeFlow(const QString &clientIdentifier, QNetworkAccessManager *manager, QObject *parent = nullptr)
Constructs a QOAuth2AuthorizationCodeFlow object using parent as parent and sets manager as the network access manager. The client identifier is set to clientIdentifier.
QOAuth2AuthorizationCodeFlow::QOAuth2AuthorizationCodeFlow(const QUrl &authenticateUrl, const QUrl &accessTokenUrl, QNetworkAccessManager *manager, QObject *parent = nullptr)
Constructs a QOAuth2AuthorizationCodeFlow object using parent as parent and sets manager as the network access manager. The authenticate URL is set to authenticateUrl and the access token URL is set to accessTokenUrl.
QOAuth2AuthorizationCodeFlow::QOAuth2AuthorizationCodeFlow(const QString &clientIdentifier, const QUrl &authenticateUrl, const QUrl &accessTokenUrl, QNetworkAccessManager *manager, QObject *parent = nullptr)
Constructs a QOAuth2AuthorizationCodeFlow object using parent as parent and sets manager as the network access manager. The client identifier is set to clientIdentifier the authenticate URL is set to authenticateUrl and the access token URL is set to accessTokenUrl.
[virtual noexcept]
QOAuth2AuthorizationCodeFlow::~QOAuth2AuthorizationCodeFlow()
Destroys the QOAuth2AuthorizationCodeFlow instance.
[until 6.13]
QUrl QOAuth2AuthorizationCodeFlow::accessTokenUrl() const
This function is scheduled for deprecation in version 6.13.
Use QAbstractOAuth2::tokenUrl() instead.
Returns the URL used to request the access token.
See also setAccessTokenUrl().
[protected]
QUrl QOAuth2AuthorizationCodeFlow::buildAuthenticateUrl(const QMultiMap<QString, QVariant> ¶meters = {})
Generates an authentication URL to be used in the Authorization Request using parameters.
[override virtual slot]
void QOAuth2AuthorizationCodeFlow::grant()
Reimplements: QAbstractOAuth::grant().
Starts the authentication flow as described in The OAuth 2.0 Authorization Framework
[noexcept, since 6.8]
QOAuth2AuthorizationCodeFlow::PkceMethod QOAuth2AuthorizationCodeFlow::pkceMethod() const
Returns the current PKCE method.
This function was introduced in Qt 6.8.
See also setPkceMethod() and QOAuth2AuthorizationCodeFlow::PkceMethod.
[slot, until 6.13]
void QOAuth2AuthorizationCodeFlow::refreshAccessToken()
This function is scheduled for deprecation in version 6.13.
Use QAbstractOAuth2::refreshTokens() instead.
Call this function to refresh the token.
This function calls refreshTokensImplementation().
[protected slot, since 6.9]
void QOAuth2AuthorizationCodeFlow::refreshTokensImplementation()
This function sends a token refresh request.
If the refresh request was initiated successfully, the status is set to QAbstractOAuth::Status::RefreshingToken; otherwise the requestFailed() signal is emitted and the status is not changed.
This function has no effect if the token refresh process is already in progress.
If refreshing the token fails and an access token exists, the status is set to QAbstractOAuth::Status::Granted, and to QAbstractOAuth::Status::NotAuthenticated if an access token does not exist.
This function was introduced in Qt 6.9.
See also QAbstractOAuth::requestFailed() and QAbstractOAuth2::refreshTokens().
[protected]
void QOAuth2AuthorizationCodeFlow::requestAccessToken(const QString &code)
Requests an access token from the received code. The code is received as a response when the user completes a successful authentication in the browser.
[override virtual protected]
void QOAuth2AuthorizationCodeFlow::resourceOwnerAuthorization(const QUrl &url, const QMultiMap<QString, QVariant> ¶meters = {})
Reimplements: QAbstractOAuth::resourceOwnerAuthorization(const QUrl &url, const QMultiMap<QString, QVariant> ¶meters).
Builds an authentication URL using url and parameters. This function emits an authorizeWithBrowser() signal to require user interaction.
[until 6.13]
void QOAuth2AuthorizationCodeFlow::setAccessTokenUrl(const QUrl &accessTokenUrl)
This function is scheduled for deprecation in version 6.13.
Use QAbstractOAuth2::setTokenUrl() instead.
Sets the URL used to request the access token to accessTokenUrl.
See also accessTokenUrl().
[since 6.8]
void QOAuth2AuthorizationCodeFlow::setPkceMethod(QOAuth2AuthorizationCodeFlow::PkceMethod method, qsizetype length = 43)
Sets the current PKCE method to method.
Optionally, the length parameter can be used to set the length of the code_verifier
. The value must be between 43 and 128 bytes. The 'code verifier' itself is random-generated by the library.
This function was introduced in Qt 6.8.
See also pkceMethod() and QOAuth2AuthorizationCodeFlow::PkceMethod.