TreeFrogFramework  2.8
Public Types | Public Member Functions | List of all members
TOAuth2Client Class Reference

#include <toauth2client.h>

Public Types

enum  ErrorCode {
  NoError = 0 , InvalidRequest , InvalidClient , InvalidGrant ,
  UnauthorizedClient , UnsupportedGrantType , AccessDenied , UnsupportedResponseType ,
  InvalidScope , ServerError , TemporarilyUnavailable , UnknownError
}
 

Public Member Functions

 TOAuth2Client (const QString &clientId, const QString &clientSecret=QString())
 
 TOAuth2Client (const TOAuth2Client &other)=default
 
TOAuth2Clientoperator= (const TOAuth2Client &other)=default
 
QUrl startAuthorization (const QUrl &requestUrl, const QStringList &scopes, const QString &state, const QUrl &redirect, const QVariantMap &parameters=QVariantMap(), int msecs=5000)
 
QString requestAccessToken (const QUrl &requestUrl, const QString &code, const QVariantMap &parameters=QVariantMap(), int msecs=5000)
 
ErrorCode errorCode ()
 
QNetworkReply::NetworkError networkError () const
 

Detailed Description

The TOAuth2Client class provides an implementation of the Authorization Code Grant flow in OAuth2 authentication methods.

See also
https://tools.ietf.org/html/rfc6749

Member Enumeration Documentation

◆ ErrorCode

Enumerator
NoError 

no error

InvalidRequest 

invalid request

InvalidClient 

invalid client

InvalidGrant 

invalid grant

UnauthorizedClient 

unauthorized client

UnsupportedGrantType 

unsupported grant type

AccessDenied 

access denied

UnsupportedResponseType 

unsupported response type

InvalidScope 

invalid scope

ServerError 

server error

TemporarilyUnavailable 

temporarily unavailable

UnknownError 

unknown error

Constructor & Destructor Documentation

◆ TOAuth2Client() [1/2]

TOAuth2Client::TOAuth2Client ( const QString &  clientId,
const QString &  clientSecret = QString() 
)

◆ TOAuth2Client() [2/2]

TOAuth2Client::TOAuth2Client ( const TOAuth2Client other)
default

Member Function Documentation

◆ errorCode()

ErrorCode TOAuth2Client::errorCode ( )
inline

◆ networkError()

QNetworkReply::NetworkError TOAuth2Client::networkError ( ) const
inline

◆ operator=()

TOAuth2Client& TOAuth2Client::operator= ( const TOAuth2Client other)
default

◆ requestAccessToken()

QString TOAuth2Client::requestAccessToken ( const QUrl &  requestUrl,
const QString &  code,
const QVariantMap &  parameters = QVariantMap(),
int  msecs = 5000 
)

Requests an access token from the authorization server's token endpoint of requestUrl by including the authorization code received.

◆ startAuthorization()

QUrl TOAuth2Client::startAuthorization ( const QUrl &  requestUrl,
const QStringList &  scopes,
const QString &  state,
const QUrl &  redirect,
const QVariantMap &  parameters = QVariantMap(),
int  msecs = 5000 
)

Initiates the flow by directing the resource owner's user-agent to the authorization endpoint of requestUrl and returns a QURL object to redirect the user-agent.


The documentation for this class was generated from the following files: