QYouTube
A Qt/C++ library and QML module to access the YouTube Data API.
 All Classes Functions Enumerations Properties Groups Pages
Public Slots | Signals | Properties | List of all members
QYouTube::AuthenticationRequest Class Reference

Handles OAuth 2.0 authentication requests. More...

Inheritance diagram for QYouTube::AuthenticationRequest:
QYouTube::Request

Public Slots

void exchangeCodeForAccessToken (const QString &code)
 Submits code in exchange for a YouTube access token.
void requestAuthorizationCode ()
 Requests a device authorization code for the current scopes.
void revokeAccessToken ()
 Revokes YouTube Data API access for the current access token.
- Public Slots inherited from QYouTube::Request
void cancel ()
 Cancels the current HTTP request.

Signals

void authorizationCodeReady (const QVariantMap &code)
 Emitted when an authorization code has been obtained using requestAuthorizationCode().
- Signals inherited from QYouTube::Request
void apiKeyChanged ()
 Emitted when the apiKey changes.
void clientIdChanged ()
 Emitted when the clientId changes.
void clientSecretChanged ()
 Emitted when the clientSecret changes.
void accessTokenChanged (const QString &token)
 Emitted when the accessToken changes.
void refreshTokenChanged (const QString &token)
 Emitted when the refreshToken changes.
void urlChanged ()
 Emitted when the url changes.
void dataChanged ()
 Emitted when the data changes.
void headersChanged ()
 Emitted when the headers change.
void operationChanged ()
 Emitted when the operation changes.
void statusChanged (Status s)
 Emitted when the status changes.
void finished ()
 Emitted when the request is completed.

Properties

QStringList scopes
 The list of scopes for which to request permission.
- Properties inherited from QYouTube::Request
QString apiKey
 The api key used when making requests to the YouTube Data API.
QString clientId
 The client id used when making requests to the YouTube Data API.
QString clientSecret
 The api key used when making requests to the YouTube Data API.
QString accessToken
 The access token used when making requests to the YouTube Data API.
QString refreshToken
 The refresh token used when making requests to the YouTube Data API.
QUrl url
 The url used when making requests to the YouTube Data API.
QVariantMap headers
 The headers used when making requests to the YouTube Data API.
QVariant data
 The data used when making HTTP PUT/POST requests to the YouTube Data API.
Operation operation
 The last HTTP operation type.
Status status
 The status of the last request.
QVariant result
 The result of the last HTTP request.
Error error
 The error resulting from the last HTTP request.
QString errorString
 A description of the error resulting from the last HTTP request.

Additional Inherited Members

- Public Types inherited from QYouTube::Request
enum  Operation
 The operation type of the last HTTP request. More...
enum  Status
 The status of the last HTTP request. More...
enum  Error
 The error resulting from the last HTTP request. More...
- Public Member Functions inherited from QYouTube::Request
void setNetworkAccessManager (QNetworkAccessManager *manager)
 Sets the QNetworkAccessManager instance to be used when making requests to the YouTube API.
- Protected Slots inherited from QYouTube::Request
void head (bool authRequired=true)
 Performs a HTTP HEAD request.
void get (bool authRequired=true)
 Performs a HTTP GET request.
void post (bool authRequired=true)
 Performs a HTTP POST request.
void put (bool authRequired=true)
 Performs a HTTP PUT request.
void deleteResource (bool authRequired=true)
 Performs a HTTP DELETE request.

Detailed Description

Handles OAuth 2.0 authentication requests.

The AuthenticationRequest class is used for obtaining and revoking access tokens for use with the YouTube Data API. AuthenticationRequest supports the installed applications flow and the devices flow.

Member Function Documentation

void QYouTube::AuthenticationRequest::exchangeCodeForAccessToken ( const QString &  code)
slot

Submits code in exchange for a YouTube access token.

This method is used when authenticating via a web view using the installed applications flow. The code is retrieved from the title of the web page.

void QYouTube::AuthenticationRequest::requestAuthorizationCode ( )
slot

Requests a device authorization code for the current scopes.

This method is used when using the devices flow.

After obtaining the authorization code, AuthenticationRequest will emit the authorizationCodeReady() signal and begin polling the server at regular intervals until either the user has granted permission or the authorization code has expired. In either case the finished() signal will be emitted, and the result will either contain a valid access token, or information about any error.

The YouTube Data API supports the following scopes:

Scope Description
https://www.googleapis.com/auth/youtube Manage a YouTube account.
https://www.googleapis.com/auth/youtube.readonly View a YouTube account.
https://www.googleapis.com/auth/youtube.upload Upload YouTube videos and manage YouTube videos.
https://www.googleapis.com/auth/youtubepartner-channel-audit Retrieve the auditDetails part in a channel resource.