diff options
Diffstat (limited to 'zend/documentation/manual/core/en/zend.gdata.clientlogin.html')
| -rw-r--r-- | zend/documentation/manual/core/en/zend.gdata.clientlogin.html | 218 |
1 files changed, 218 insertions, 0 deletions
diff --git a/zend/documentation/manual/core/en/zend.gdata.clientlogin.html b/zend/documentation/manual/core/en/zend.gdata.clientlogin.html new file mode 100644 index 0000000..ef4a7f7 --- /dev/null +++ b/zend/documentation/manual/core/en/zend.gdata.clientlogin.html @@ -0,0 +1,218 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> + <title>Authenticating with ClientLogin - Zend Framework Manual</title> + +</head> +<body> +<table width="100%"> + <tr valign="top"> + <td width="85%"> + <table width="100%"> + <tr> + <td width="25%" style="text-align: left;"> + <a href="zend.gdata.books.html">Using the Book Search Data API</a> + </td> + + <td width="50%" style="text-align: center;"> + <div class="up"><span class="up"><a href="zend.gdata.html">Zend_Gdata</a></span><br /> + <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div> + </td> + + <td width="25%" style="text-align: right;"> + <div class="next" style="text-align: right; float: right;"><a href="zend.gdata.calendar.html">Using Google Calendar</a></div> + </td> + </tr> + </table> +<hr /> +<div id="zend.gdata.clientlogin" class="section"><div class="info"><h1 class="title">Authenticating with ClientLogin</h1></div> + + + <p class="para"> + The ClientLogin mechanism enables you to write <acronym class="acronym">PHP</acronym> application + that acquire authenticated access to Google Services, + specifying a user's credentials in the <acronym class="acronym">HTTP</acronym> Client. + </p> + + <p class="para"> + See <a href="http://code.google.com/apis/accounts/AuthForInstalledApps.html" class="link external">» http://code.google.com/apis/accounts/AuthForInstalledApps.html</a> + for more information about Google Data ClientLogin authentication. + </p> + + <p class="para"> + The Google documentation says the ClientLogin mechanism is appropriate + for "installed applications" whereas the AuthSub mechanism is + for "web applications." The difference is that AuthSub requires + interaction from the user, and a browser interface that can react + to redirection requests. The ClientLogin solution uses <acronym class="acronym">PHP</acronym> code to + supply the account credentials; the user is not required to enter her + credentials interactively. + </p> + + <p class="para"> + The account credentials supplied via the ClientLogin mechanism must + be valid credentials for Google services, but they are not required + to be those of the user who is using the <acronym class="acronym">PHP</acronym> application. + </p> + + <div class="section" id="zend.gdata.clientlogin.login" name="zend.gdata.clientlogin.login"><div class="info"><h1 class="title">Creating a ClientLogin authenticated Http Client</h1></div> + + + <p class="para"> + The process of creating an authenticated <acronym class="acronym">HTTP</acronym> client using + the ClientLogin mechanism is to call the static function + <span class="methodname">Zend_Gdata_ClientLogin::getHttpClient()</span> + and pass the Google account credentials in plain text. + The return value of this function is an object of class + <span class="classname">Zend_Http_Client</span>. + </p> + + <p class="para"> + The optional third parameter is the name of the Google Data + service. For instance, this can be 'cl' for Google Calendar. + The default is "xapi", which is recognized by Google Data + servers as a generic service name. + </p> + + <p class="para"> + The optional fourth parameter is an instance of <span class="classname">Zend_Http_Client</span>. + This allows you to set options in the client, such as proxy + server settings. If you pass <b><tt>NULL</tt></b> for this + parameter, a generic <span class="classname">Zend_Http_Client</span> object is created. + </p> + + <p class="para"> + The optional fifth parameter is a short string that Google Data + servers use to identify the client application for logging + purposes. By default this is string "Zend-ZendFramework"; + </p> + + <p class="para"> + The optional sixth parameter is a string ID for a + <span_trademark class="trademark">CAPTCHA</span_trademark> challenge that has been issued by + the server. It is only necessary when logging in after receiving + a <span_trademark class="trademark">CAPTCHA</span_trademark> challenge from a previous + login attempt. + </p> + + <p class="para"> + The optional seventh parameter is a user's response to a + <span_trademark class="trademark">CAPTCHA</span_trademark> challenge that has been issued by + the server. It is only necessary when logging in after receiving + a <span_trademark class="trademark">CAPTCHA</span_trademark> challenge from a previous + login attempt. + </p> + + <p class="para"> + Below is an example of <acronym class="acronym">PHP</acronym> code for a web application + to acquire authentication to use the Google Calendar service + and create a <span class="classname">Zend_Gdata</span> client object using that authenticated + <span class="classname">Zend_Http_Client</span>. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Enter your Google account credentials</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$email</span> = <span style="color: #ff0000;">'johndoe@gmail.com'</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$passwd</span> = <span style="color: #ff0000;">'xxxxxxxx'</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">try <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #0000ff;">$client</span> = Zend_Gdata_ClientLogin::<span style="color: #006600;">getHttpClient</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$email</span>, <span style="color: #0000ff;">$passwd</span>, <span style="color: #ff0000;">'cl'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span> catch <span style="color: #66cc66;">(</span>Zend_Gdata_App_CaptchaRequiredException <span style="color: #0000ff;">$cre</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'URL of CAPTCHA image: '</span> . <span style="color: #0000ff;">$cre</span>-><span style="color: #006600;">getCaptchaUrl</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Token ID: '</span> . <span style="color: #0000ff;">$cre</span>-><span style="color: #006600;">getCaptchaToken</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span> catch <span style="color: #66cc66;">(</span>Zend_Gdata_App_AuthException <span style="color: #0000ff;">$ae</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Problem authenticating: '</span> . <span style="color: #0000ff;">$ae</span>-><span style="color: #006600;">exception</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$cal</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Gdata_Calendar<span style="color: #66cc66;">(</span><span style="color: #0000ff;">$client</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.clientlogin.terminating" name="zend.gdata.clientlogin.terminating"><div class="info"><h1 class="title">Terminating a ClientLogin authenticated Http Client</h1></div> + + + <p class="para"> + There is no method to revoke ClientLogin authentication as there + is in the AuthSub token-based solution. The credentials used + in the ClientLogin authentication are the login and password + to a Google account, and therefore these can be used repeatedly + in the future. + </p> + </div> +</div> + <hr /> + + <table width="100%"> + <tr> + <td width="25%" style="text-align: left;"> + <a href="zend.gdata.books.html">Using the Book Search Data API</a> + </td> + + <td width="50%" style="text-align: center;"> + <div class="up"><span class="up"><a href="zend.gdata.html">Zend_Gdata</a></span><br /> + <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div> + </td> + + <td width="25%" style="text-align: right;"> + <div class="next" style="text-align: right; float: right;"><a href="zend.gdata.calendar.html">Using Google Calendar</a></div> + </td> + </tr> + </table> +</td> + <td style="font-size: smaller;" width="15%"> <style type="text/css"> +#leftbar { + float: left; + width: 186px; + padding: 5px; + font-size: smaller; +} +ul.toc { + margin: 0px 5px 5px 5px; + padding: 0px; +} +ul.toc li { + font-size: 85%; + margin: 1px 0 1px 1px; + padding: 1px 0 1px 11px; + list-style-type: none; + background-repeat: no-repeat; + background-position: center left; +} +ul.toc li.header { + font-size: 115%; + padding: 5px 0px 5px 11px; + border-bottom: 1px solid #cccccc; + margin-bottom: 5px; +} +ul.toc li.active { + font-weight: bold; +} +ul.toc li a { + text-decoration: none; +} +ul.toc li a:hover { + text-decoration: underline; +} +</style> + <ul class="toc"> + <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li> + <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li> + <li class="header up"><a href="reference.html">Zend Gdata Reference</a></li> + <li class="header up"><a href="zend.gdata.html">Zend_Gdata</a></li> + <li><a href="zend.gdata.analytics.html">Using Google Analytics</a></li> + <li><a href="zend.gdata.authsub.html">Authenticating with AuthSub</a></li> + <li><a href="zend.gdata.books.html">Using the Book Search Data API</a></li> + <li class="active"><a href="zend.gdata.clientlogin.html">Authenticating with ClientLogin</a></li> + <li><a href="zend.gdata.calendar.html">Using Google Calendar</a></li> + <li><a href="zend.gdata.docs.html">Using Google Documents List Data API</a></li> + <li><a href="zend.gdata.spreadsheets.html">Using Google Spreadsheets</a></li> + <li><a href="zend.gdata.gapps.html">Using Google Apps Provisioning</a></li> + <li><a href="zend.gdata.photos.html">Using Picasa Web Albums</a></li> + <li><a href="zend.gdata.youtube.html">Using the YouTube Data API</a></li> + <li><a href="zend.gdata.exception.html">Catching Gdata Exceptions</a></li> + </ul> + </td> + </tr> +</table> +</body> +</html>
\ No newline at end of file |
