klenwell information services : GreqoDocRequestGoogleToken

Revision [53]

This is an old revision of GreqoDocRequestGoogleToken made by KlenwellAdmin on 2006-12-30 14:48:52.
 
For the new Blogger API, any request or transaction must be accompanied by an authentication token set as a header for the request. This token must be requested using one of two methods promoted by Google as part of their Data API. If the account settings are properly set in blogger_data.inc.php, the function greqo_request_clientlogin_token will request and store a token for use with any Blogger API requests.

Sample Code

if ( greqo_request_clientlogin_token($GREQO['BLOGGER']['user'], $GREQO['BLOGGER']['password'], 'blogger', 1) ) 
{
	$_FLAG['request_feed'] = 1;
}
else
{
	trigger_error('google authentication failed.  make sure you have the correct account settings in blogger_data.inc.php and check the status of your blogger account", E_USER_WARNING);
}


Functions

string greqo_request_clientlogin_token ( string user name, string password, string Google service[, array int force] )

This function requests an authentication token from the Google servers using the ClientLogin interface

If the option force parameter is set to 0 and the token has already been requested, it will return the current token. If force is set to 1, it will request a new token.

It returns the token itself as a string if the request is successful and 0 if it fails or there is an error. It also assigns the token to $_SESSION['GDATA']['auth_token'] where it will be accessible as a global variable to other functions that require it within the library.

If the force parameter is set to 0,

Notes

Old Blogger accounts used basic authentication to authenticate users. According to the Blogger Data API, this authentication method should now work with old Blogger Accounts. However, I have not successfully authenticated an old account with this method. Meanwhile, as of this writing, basic authentication still works (see lastgoogle.blogspot.com).