Classes | |
| class | Interface |
| This class provides means for interaction with network services supporting OAuth authorization scheme. More... | |
Typedefs | |
|
typedef QMultiMap< QByteArray, QByteArray > | ParamMap |
| A typedef for the data structure for storing request parameters. | |
Enumerations | |
| enum | SignatureMethod { HMAC_SHA1, RSA_SHA1, PLAINTEXT } |
| This enum type describes the signature method used by the request. More... | |
| enum | HttpMethod { GET, POST, HEAD, PUT, DELETE } |
| This enum type specifies the HTTP method used for creating a Signature Base String and/or sending a request. More... | |
| enum | ParsingMode { ParseForRequestContent, ParseForInlineQuery, ParseForHeaderArguments, ParseForSignatureBaseString } |
| This enum type specifies the method of parsing parameters into a parameter string. More... | |
| enum | ErrorCode { NoError = 200, BadRequest = 400, Unauthorized = 401, Forbidden = 403, Timeout = 1001, ConsumerKeyEmpty, ConsumerSecretEmpty, UnsupportedHttpMethod, RSAPrivateKeyEmpty = 1101, RSADecodingError, RSAKeyFileError, OtherError } |
| This enum type defines error types that are assigned to the QOAuth::Interface::error property. More... | |
Functions | |
| QByteArray | supportedOAuthVersion () |
| Returns the supported OAuth protocol version. | |
| QByteArray | tokenParameterName () |
| Returns the name of the Access Token argument parameter. | |
| QByteArray | tokenSecretParameterName () |
| Returns the name of the Token Secret argument parameter. | |
| enum QOAuth::ErrorCode |
This error codes collection contains both network-related errors and those that can occur when incorrect arguments are provided to any of the class's methods.
| NoError | No error occured (so far :-) ). |
| BadRequest |
Represents HTTP status code 400 (Bad Request). |
| Unauthorized |
Represents HTTP status code 401 (Unauthorized). |
| Forbidden |
Represents HTTP status code 403 (Forbidden). |
| Timeout | Represents a request timeout error. |
| ConsumerKeyEmpty | Consumer key has not been provided. |
| ConsumerSecretEmpty | Consumer secret has not been provided. |
| UnsupportedHttpMethod | The HTTP method is not supported by the request. Note that QOAuth::Interface::requestToken() and QOAuth::Interface::accessToken() accept only HTTP GET and POST requests. |
| RSAPrivateKeyEmpty | RSA private key has not been provided. |
| RSADecodingError | There was a problem decoding the RSA private key (the key is invalid or the provided passphrase is incorrect) |
| RSAKeyFileError | The provided key file either doesn't exist or is unreadable. |
| OtherError | A network-related error not specified above. |
| enum QOAuth::HttpMethod |
The HTTP method has to be specified in QOAuth class for two reasons:
| enum QOAuth::ParsingMode |
When creating a parameters string for a custom request using QOAuth::Interface::createParametersString() the parsing mode must be defined in order to prepare the string correctly.
According to what is stated in OAuth 1.0 Core specification, parameters can be passed in a request to the Service Provider in 3 different ways. When using QOAuth::Interface::createParametersString(), choose the one that suits you by setting ParsingMode appropriatelly.
| ParseForRequestContent |
Inline query format (foo=bar&bar=baz&baz=foo ...), suitable for POST requests. |
| ParseForInlineQuery | Same as ParseForRequestContent, but prepends the string with a question mark - suitable for GET requests (appending parameters to the request URL) |
| ParseForHeaderArguments | HTTP request header format (parameters to be put inside a request header). |
| ParseForSignatureBaseString | Signature Base String format, meant for internal use. |
There are 3 different signature methods defined by the OAuth protocol. This enum is used to specify the method used by a specific request. Hence, one of its values must be passed as a parameter in any of the QOAuth::Interface::requestToken(), QOAuth::Interface::accessToken() or QOAuth::Interface::createParametersString() method.
| QByteArray QOAuth::tokenParameterName | ( | ) |
Useful when reading Service Provider's reply for QOAuth::Interface::accessToken() request, e.g:
QOAuth::Interface qoauth; QByteArray requestToken = "token"; QByteArray requestTokenSecret = "secret"; QOAuth::ParamMap reply = qoauth.accessToken( "http://example.com/access_token", QOAuth::POST, token, tokenSecret, QOAuth::HMAC_SHA1 ); if ( qoauth.error() == QOAuth::NoError ) { token = reply.value( QOAuth::tokenParameterName() ); tokenSecret = reply.value( QOAuth::tokenSecretParameterName() ); }
| QByteArray QOAuth::tokenSecretParameterName | ( | ) |
1.5.8