OLD | NEW |
1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: | 1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: |
2 1) The <head> information in this page is significant, should be uniform | 2 1) The <head> information in this page is significant, should be uniform |
3 across api docs and should be edited only with knowledge of the | 3 across api docs and should be edited only with knowledge of the |
4 templating mechanism. | 4 templating mechanism. |
5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a | 5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a |
6 browser, it will be re-generated from the template, json schema and | 6 browser, it will be re-generated from the template, json schema and |
7 authored overview content. | 7 authored overview content. |
8 4) The <body>.innerHTML is also generated by an offline step so that this | 8 4) The <body>.innerHTML is also generated by an offline step so that this |
9 page may easily be indexed by search engines. | 9 page may easily be indexed by search engines. |
10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> | 10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 <li><a href="history.html">History</a></li> | 125 <li><a href="history.html">History</a></li> |
126 <li><a href="management.html">Management</a></li> | 126 <li><a href="management.html">Management</a></li> |
127 <li><a href="tabs.html">Tabs</a></li> | 127 <li><a href="tabs.html">Tabs</a></li> |
128 <li><a href="windows.html">Windows</a></li> | 128 <li><a href="windows.html">Windows</a></li> |
129 </ul> | 129 </ul> |
130 </li> | 130 </li> |
131 <li>Implementation | 131 <li>Implementation |
132 <ul> | 132 <ul> |
133 <li><a href="a11y.html">Accessibility</a></li> | 133 <li><a href="a11y.html">Accessibility</a></li> |
134 <li><a href="background_pages.html">Background Pages</a></li> | 134 <li><a href="background_pages.html">Background Pages</a></li> |
| 135 <li><a href="transient_background_pages.html">Event Pages</a><
/li> |
135 <li><a href="content_scripts.html">Content Scripts</a></li> | 136 <li><a href="content_scripts.html">Content Scripts</a></li> |
136 <li><a href="xhr.html">Cross-Origin XHR</a></li> | 137 <li><a href="xhr.html">Cross-Origin XHR</a></li> |
137 <li><a href="i18n.html">Internationalization</a></li> | 138 <li><a href="i18n.html">Internationalization</a></li> |
138 <li><a href="messaging.html">Message Passing</a></li> | 139 <li><a href="messaging.html">Message Passing</a></li> |
139 <li><a href="permissions.html">Optional Permissions</a></li> | 140 <li><a href="permissions.html">Optional Permissions</a></li> |
140 <li><a href="npapi.html">NPAPI Plugins</a></li> | 141 <li><a href="npapi.html">NPAPI Plugins</a></li> |
141 </ul> | 142 </ul> |
142 </li> | 143 </li> |
143 <li>Finishing | 144 <li>Finishing |
144 <ul> | 145 <ul> |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 <pre>var oauth = ChromeExOAuth.initBackgroundPage({ | 280 <pre>var oauth = ChromeExOAuth.initBackgroundPage({ |
280 'request_url': 'https://www.google.com/accounts/OAuthGetRequestToken', | 281 'request_url': 'https://www.google.com/accounts/OAuthGetRequestToken', |
281 'authorize_url': 'https://www.google.com/accounts/OAuthAuthorizeToken', | 282 'authorize_url': 'https://www.google.com/accounts/OAuthAuthorizeToken', |
282 'access_url': 'https://www.google.com/accounts/OAuthGetAccessToken', | 283 'access_url': 'https://www.google.com/accounts/OAuthGetAccessToken', |
283 'consumer_key': 'anonymous', | 284 'consumer_key': 'anonymous', |
284 'consumer_secret': 'anonymous', | 285 'consumer_secret': 'anonymous', |
285 'scope': 'https://docs.google.com/feeds/', | 286 'scope': 'https://docs.google.com/feeds/', |
286 'app_name': 'My Google Docs Extension' | 287 'app_name': 'My Google Docs Extension' |
287 }); | 288 }); |
288 </pre> | 289 </pre> |
| 290 <p> |
| 291 To use the OAuth library, |
| 292 you must declare the "tabs" permision in the |
| 293 <a href="http://code.google.com/chrome/extensions/manifest.html">extension manif
est</a>. |
| 294 You must also declare the sites you are using |
| 295 including the request URL, the authorize URL, access URL, |
| 296 and, if necessary, the scope URL. |
| 297 For example: |
| 298 </p> |
| 299 <pre>"permissions": [ "tabs", "https://docs.google.com/feeds/*", |
| 300 "https://www.google.com/accounts/OAuthGetRequestToken", |
| 301 "https://www.google.com/accounts/OAuthAuthorizeToken", |
| 302 "https://www.google.com/accounts/OAuthGetAccessToken" |
| 303 ] |
| 304 </pre> |
289 <h3 id="request-token">Fetching and authorizing a request token</h3> | 305 <h3 id="request-token">Fetching and authorizing a request token</h3> |
290 <p> | 306 <p> |
291 Once you have your background page set up, call the <code>authorize()</code> fun
ction to begin the OAuth dance and redirect the user to the OAuth provider. The
client library abstracts most of this process, so all you need to do is pass a c
allback to the <code>authorize()</code> function, and a new tab will open and re
direct the user. | 307 Once you have your background page set up, call the <code>authorize()</code> fun
ction to begin the OAuth dance and redirect the user to the OAuth provider. The
client library abstracts most of this process, so all you need to do is pass a c
allback to the <code>authorize()</code> function, and a new tab will open and re
direct the user. |
292 </p> | 308 </p> |
293 <pre>oauth.authorize(function() { | 309 <pre>oauth.authorize(function() { |
294 // ... Ready to fetch private data ... | 310 // ... Ready to fetch private data ... |
295 }); | 311 }); |
296 </pre> | 312 </pre> |
297 <p> | 313 <p> |
298 You don't need to provide any additional logic for storing the token and secret,
as this library already stores these values in the browser’s <code>localStorage
</code>. If the library already has an access token stored for the current scope
, then no tab will be opened. In either case, the callback will be called. | 314 You don't need to provide any additional logic for storing the token and secret,
as this library already stores these values in the browser’s <code>localStorage
</code>. If the library already has an access token stored for the current scope
, then no tab will be opened. In either case, the callback will be called. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 _uff=0; | 418 _uff=0; |
403 urchinTracker(); | 419 urchinTracker(); |
404 } | 420 } |
405 catch(e) {/* urchinTracker not available. */} | 421 catch(e) {/* urchinTracker not available. */} |
406 </script> | 422 </script> |
407 <!-- end analytics --> | 423 <!-- end analytics --> |
408 </div> | 424 </div> |
409 </div> <!-- /gc-footer --> | 425 </div> <!-- /gc-footer --> |
410 </div> <!-- /gc-container --> | 426 </div> <!-- /gc-container --> |
411 </body></html> | 427 </body></html> |
OLD | NEW |