TreeFrogFramework  2.8
toauth2client.h
Go to the documentation of this file.
1 #pragma once
2 #include <QNetworkReply>
3 #include <QStringList>
4 #include <QUrl>
5 #include <QVariantMap>
6 #include <TGlobal>
7 
8 
10 public:
11  enum ErrorCode {
12  NoError = 0,
24  };
25 
26  TOAuth2Client(const QString &clientId, const QString &clientSecret = QString());
27  TOAuth2Client(const TOAuth2Client &other) = default;
28  TOAuth2Client &operator=(const TOAuth2Client &other) = default;
29 
30  QUrl startAuthorization(const QUrl &requestUrl, const QStringList &scopes, const QString &state, const QUrl &redirect, const QVariantMap &parameters = QVariantMap(), int msecs = 5000);
31  QString requestAccessToken(const QUrl &requestUrl, const QString &code, const QVariantMap &parameters = QVariantMap(), int msecs = 5000);
32  ErrorCode errorCode() { return _errorCode; }
33  QNetworkReply::NetworkError networkError() const { return _networkError; }
34 
35 private:
36  QString _clientId;
37  QString _clientSecret;
38  ErrorCode _errorCode {NoError};
39  QNetworkReply::NetworkError _networkError {QNetworkReply::NoError};
40 };
41 
The TOAuth2Client class provides an implementation of the Authorization Code Grant flow in OAuth2 aut...
Definition: toauth2client.h:9
QNetworkReply::NetworkError networkError() const
Definition: toauth2client.h:33
TOAuth2Client(const TOAuth2Client &other)=default
TOAuth2Client & operator=(const TOAuth2Client &other)=default
ErrorCode errorCode()
Definition: toauth2client.h:32
ErrorCode
Definition: toauth2client.h:11
@ InvalidGrant
invalid grant
Definition: toauth2client.h:15
@ InvalidClient
invalid client
Definition: toauth2client.h:14
@ AccessDenied
access denied
Definition: toauth2client.h:18
@ UnsupportedGrantType
unsupported grant type
Definition: toauth2client.h:17
@ UnauthorizedClient
unauthorized client
Definition: toauth2client.h:16
@ InvalidRequest
invalid request
Definition: toauth2client.h:13
@ UnknownError
unknown error
Definition: toauth2client.h:23
@ ServerError
server error
Definition: toauth2client.h:21
@ TemporarilyUnavailable
temporarily unavailable
Definition: toauth2client.h:22
@ InvalidScope
invalid scope
Definition: toauth2client.h:20
@ UnsupportedResponseType
unsupported response type
Definition: toauth2client.h:19
#define T_CORE_EXPORT
Definition: tdeclexport.h:28