PySide6.QtNetworkAuth.QAbstractOAuth2¶
- class QAbstractOAuth2¶
The
QAbstractOAuth2
class is the base of all implementations of OAuth 2 authentication methods. More…Inherited by:
QOAuth2AuthorizationCodeFlow
Synopsis¶
Properties¶
scopeᅟ
- This property holds the desired scope which defines the permissions requested by the client
Methods¶
def
__init__()
def
expirationAt()
def
refreshToken()
def
responseType()
def
scope()
def
setScope()
def
setState()
def
setUserAgent()
def
state()
def
userAgent()
Virtual methods¶
Signals¶
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
The class defines the basic interface of the OAuth 2 authentication classes. By inheriting this class, you can create custom authentication methods using the OAuth 2 standard for different web services.
A description of how OAuth 2 works can be found in: The OAuth 2.0 Authorization Framework
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.This property holds the client shared key used as a password if the server requires authentication to request the token.
- Access functions:
This property holds the expiration time of the current access token.
- Access functions:
- property refreshTokenᅟ: str¶
- Access functions:
- property scopeᅟ: str¶
This property holds This property holds the desired scope which defines the permissions requested by the client..
The scope value is updated to the scope value granted by the authorization server. In case of an empty scope response, the requested scope is assumed as granted and does not change .
- Access functions:
Signal
scopeChanged()
- property stateᅟ: str¶
This property holds the string sent to the server during authentication. The state is used to identify and validate the request when the callback is received.
- Access functions:
Signal
stateChanged()
- property userAgentᅟ: str¶
This property holds the User-Agent header used to create the network requests.
The default value is “QtOAuth/1.0 (+https://www.qt.io)”.
- Access functions:
Constructs a
QAbstractOAuth2
object usingparent
as parent.- __init__(manager[, parent=None])
- Parameters:
manager –
QNetworkAccessManager
parent –
QObject
Constructs a
QAbstractOAuth2
object usingparent
as parent and setsmanager
as the network access manager.- authorizationCallbackReceived(data)¶
- Parameters:
data – Dictionary with keys of type .QString and values of type QVariant.
Signal emitted when the reply server receives the authorization callback from the server:
data
contains the values received from the server.- clientIdentifierSharedKey()¶
- Return type:
str
See also
Getter of property
clientIdentifierSharedKeyᅟ
.- Parameters:
clientIdentifierSharedKey – str
Notification signal of property
clientIdentifierSharedKeyᅟ
.- createAuthenticatedUrl(url[, parameters=QVariantMap()])¶
The returned URL is based on
url
, combining it with the givenparameters
and the access token.Signal emitted when the server responds to the authorization request with an error as defined in RFC 6749 error response .
error
is the name of the error;errorDescription
describes the error anduri
is an optional URI containing more information about the error.See also
Getter of property
expirationᅟ
.Notification signal of property
expirationᅟ
.- post(url, multiPart)¶
- Parameters:
url –
QUrl
multiPart –
QHttpMultiPart
- Return type:
Note
This function is deprecated.
Please use QtNetwork classes directly instead, see HTTP method alternatives .
This is an overloaded function.
Sends an authenticated POST request and returns a new QNetworkReply. The
url
andmultiPart
are used to create the request.{Hypertext Transfer Protocol – HTTP/1.1: POST}
- post(url, data)
- Parameters:
url –
QUrl
data –
QByteArray
- Return type:
Note
This function is deprecated.
Please use QtNetwork classes directly instead, see HTTP method alternatives .
This is an overloaded function.
Sends an authenticated POST request and returns a new QNetworkReply. The
url
anddata
are used to create the request.{Hypertext Transfer Protocol – HTTP/1.1: POST}
- put(url, multiPart)¶
- Parameters:
url –
QUrl
multiPart –
QHttpMultiPart
- Return type:
Note
This function is deprecated.
Please use QtNetwork classes directly instead, see HTTP method alternatives .
This is an overloaded function.
Sends an authenticated PUT request and returns a new QNetworkReply. The
url
andmultiPart
are used to create the request.{Hypertext Transfer Protocol – HTTP/1.1: PUT}
- put(url, data)
- Parameters:
url –
QUrl
data –
QByteArray
- Return type:
Note
This function is deprecated.
Please use QtNetwork classes directly instead, see HTTP method alternatives .
This is an overloaded function.
Sends an authenticated PUT request and returns a new QNetworkReply. The
url
anddata
are used to create the request.{Hypertext Transfer Protocol – HTTP/1.1: PUT}
- refreshToken()¶
- Return type:
str
Gets the current refresh token.
Refresh tokens usually have longer lifespans than access tokens, so it makes sense to save them for later use.
Returns the current refresh token or an empty string, if there is no refresh token available.
See also
Getter of property
refreshTokenᅟ
.- refreshTokenChanged(refreshToken)¶
- Parameters:
refreshToken – str
Notification signal of property
refreshTokenᅟ
.- responseType()¶
- Return type:
str
Returns the response_type used.
- responseTypeChanged(responseType)¶
- Parameters:
responseType – str
- scope()¶
- Return type:
str
See also
Getter of property
scopeᅟ
.- scopeChanged(scope)¶
- Parameters:
scope – str
Notification signal of property
scopeᅟ
.- Parameters:
clientIdentifierSharedKey – str
See also
Setter of property
clientIdentifierSharedKeyᅟ
.- setRefreshToken(refreshToken)¶
- Parameters:
refreshToken – str
Sets the new refresh token
refreshToken
to be used.A custom refresh token can be used to refresh the access token via this method and then the access token can be refreshed via
refreshAccessToken()
.See also
Setter of property
refreshTokenᅟ
.- setResponseType(responseType)¶
- Parameters:
responseType – str
Setter of property
scopeᅟ
.- setSslConfiguration(configuration)¶
- Parameters:
configuration –
QSslConfiguration
Sets the TLS
configuration
to be used when establishing a mutual TLS connection between the client and the Authorization Server.Setter of property
stateᅟ
.- setUserAgent(userAgent)¶
- Parameters:
userAgent – str
See also
Setter of property
userAgentᅟ
.- sslConfiguration()¶
- Return type:
Returns the TLS configuration to be used when establishing a mutual TLS connection between the client and the Authorization Server.
- sslConfigurationChanged(configuration)¶
- Parameters:
configuration –
QSslConfiguration
The signal is emitted when the TLS configuration has changed. The
configuration
parameter contains the new TLS configuration.See also
- state()¶
- Return type:
str
See also
Getter of property
stateᅟ
.- stateChanged(state)¶
- Parameters:
state – str
Notification signal of property
stateᅟ
.- userAgent()¶
- Return type:
str
See also
Getter of property
userAgentᅟ
.- userAgentChanged(userAgent)¶
- Parameters:
userAgent – str
Notification signal of property
userAgentᅟ
.