request_authentication_uri


Description:

public string request_authentication_uri (out string token, out string token_secret, Cancellable? cancellable = null) throws Error

Requests a fresh unauthenticated token from the Google accounts service and builds and returns the URI of an authentication page for that token.

This should then be presented to the user (e.g. in an embedded or stand alone web browser). The authentication page will ask the user to log in using their Google account, then ask them to grant access to the AuthorizationDomains passed to the constructor of the OAuth1Authorizer. If the user grants access, they will be given a verifier, which can then be passed to request_authorization (along with the token and token_secret values returned by this method) to authorize the token.

This method can fail if the server returns an error, but this is unlikely. If it does happen, a gdata_service_error_protocol_error will be raised, token and token_secret will be set to null and null will be returned.

This method implements <ulink type="http" url="http://tools.ietf.org/html/rfc5849section-2.1">Section 2.1</ulink > and <ulink type="http" url="http://tools.ietf.org/html/rfc5849section-2.2">Section 2.2</ulink> of the < ulink type="http" url="http://tools.ietf.org/html/rfc5849">OAuth 1.0 protocol</ulink>.

When freeing token_secret, it's advisable to set it to all zeros first, to reduce the chance of the sensitive token being recoverable from the free memory pool and (accidentally) leaked by a different part of the process. This can be achieved with the following code:

if (token_secret != NULL) {
memset (token_secret, 0, strlen (token_secret));
g_free (token_secret);
}

Parameters:

this

a OAuth1Authorizer

token

return location for the temporary credentials token returned by the authentication service; free with g_free

token_secret

return location for the temporary credentials token secret returned by the authentication service; free with g_free

cancellable

optional Cancellable object, or null

Returns:

the URI of an authentication page for the user to use; free with g_free