Revision [538]
Last edited on 2007-06-05 19:34:59 by KlenwellAdminAdditions:
=====Greqo Docs : Requesting a Google Auth Token=====
Revision [537]
Edited on 2007-06-05 19:34:29 by KlenwellAdminAdditions:
For Google Data services, like the new [[http://code.google.com/apis/gdata/blogger.html 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 [[http://code.google.com/apis/gdata/index.html GData API]]. The request_clientlogin_token method will request and store a token for use with any Blogger API requests.
$GreqoBlogger = new GreqoBlogger($debug=1);
$GreqoBlogger->email = 'user@gmail.com';
$GreqoBlogger->password = '*********';
if ( $GreqoBlogger->request_clientlogin_token($service='blogger', $force=1) )
$_HTML['stdout'] .= '
#$_HTML['stdout'] .= '
$_HTML['stdout'] .= '
====Methods====
**string request_clientlogin_token( string Google service[, int force] )**
This method requests an authentication token from the Google servers using the [[http://code.google.com/apis/accounts/AuthForInstalledApps.html ClientLogin interface]]
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']** for reuse within the same session.
$GreqoBlogger = new GreqoBlogger($debug=1);
$GreqoBlogger->email = 'user@gmail.com';
$GreqoBlogger->password = '*********';
if ( $GreqoBlogger->request_clientlogin_token($service='blogger', $force=1) )
$_HTML['stdout'] .= '
token for user ' .$GreqoBlogger->email. ' retrieved
';#$_HTML['stdout'] .= '
token: ' .$_SESSION['GDATA']['auth_token']. '
';$_HTML['stdout'] .= '
unable to retrieve authentication token (devs have been notified)
';====Methods====
**string request_clientlogin_token( string Google service[, int force] )**
This method requests an authentication token from the Google servers using the [[http://code.google.com/apis/accounts/AuthForInstalledApps.html ClientLogin interface]]
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']** for reuse within the same session.
Deletions:
if ( greqo_request_clientlogin_token($GREQO['BLOGGER']['user'], $GREQO['BLOGGER']['password'], 'blogger', 1) )
$_FLAG['gdata_auth_ok'] = 1;
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[, int force] )**
This function requests an authentication token from the Google servers using the [[http://code.google.com/apis/accounts/AuthForInstalledApps.html ClientLogin interface]]
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.
Old Blogger accounts used basic authentication to authenticate users. [[http://code.google.com/apis/gdata/blogger.html#Versions According to the Blogger Data API]], this authentication method should now work with old Blogger Accounts. However, I have not successfully authenticated an old Blogger account with this method. Meanwhile, as of this writing, basic authentication still works (see [[http://lastgoogle.blogspot.com/ lastgoogle.blogspot.com]]).
Revision [216]
Edited on 2007-02-21 14:14:27 by KlenwellAdminAdditions:
**string greqo_request_clientlogin_token ( string user name, string password, string Google service[, int force] )**
Deletions:
Revision [215]
Edited on 2007-02-21 14:13:37 by KlenwellAdminDeletions:
Revision [59]
Edited on 2006-12-30 15:01:59 by KlenwellAdminAdditions:
$_FLAG['gdata_auth_ok'] = 1;
Deletions:
Revision [58]
Edited on 2006-12-30 15:01:08 by KlenwellAdminAdditions:
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);
Deletions:
Revision [57]
Edited on 2006-12-30 15:00:30 by KlenwellAdminAdditions:
%%(php)
Old Blogger accounts used basic authentication to authenticate users. [[http://code.google.com/apis/gdata/blogger.html#Versions According to the Blogger Data API]], this authentication method should now work with old Blogger Accounts. However, I have not successfully authenticated an old Blogger account with this method. Meanwhile, as of this writing, basic authentication still works (see [[http://lastgoogle.blogspot.com/ lastgoogle.blogspot.com]]).
Old Blogger accounts used basic authentication to authenticate users. [[http://code.google.com/apis/gdata/blogger.html#Versions According to the Blogger Data API]], this authentication method should now work with old Blogger Accounts. However, I have not successfully authenticated an old Blogger account with this method. Meanwhile, as of this writing, basic authentication still works (see [[http://lastgoogle.blogspot.com/ lastgoogle.blogspot.com]]).
Deletions:
Revision [56]
Edited on 2006-12-30 14:56:45 by KlenwellAdminAdditions:
**string greqo_request_clientlogin_token ( string user name, string password, string Google service[, array int force] )**
If the optional ''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. The default is **1**.
How often do you need to renew an authentication token? The answer seems to be: when in doubt, get a new token. See [[http://groups.google.com/group/bloggerDev/browse_frm/thread/f41921c75119f442 this post]].
If the optional ''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. The default is **1**.
How often do you need to renew an authentication token? The answer seems to be: when in doubt, get a new token. See [[http://groups.google.com/group/bloggerDev/browse_frm/thread/f41921c75119f442 this post]].
Deletions:
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.
Revision [54]
Edited on 2006-12-30 14:51:09 by KlenwellAdminAdditions:
For the new [[http://code.google.com/apis/gdata/blogger.html Blogger Data 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 [[http://code.google.com/apis/gdata/index.html GData 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.
$_FLAG['request_feed'] = 1;
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);
----
[[CategoryGreqo]]
$_FLAG['request_feed'] = 1;
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);
----
[[CategoryGreqo]]
Deletions:
$_FLAG['request_feed'] = 1;
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);