An easy way to complete the OAuth2 process in a Google Chrome Extension
Latest commit 88c0877 Jun 24, 2013 @jjNford Initial commit for v2.0.0.

Chrome Extension OAuth2 Library

Provides a simple way to retrieve an OAuth2 token for API authorization within a Google Chrome Extension.

How To Use

  1. Add the following to your extension manifest:

    Note: The permissions url and content_script > matches URL are determined by the API you are requesting authorization for.

  2. Add application and API information to libs/chrome-ex-auth/oauth2.js:

        (function() {
            window.oauth2 = {
            access_token_url: "{your-access-token-url}",
            authorization_url: "{your-authorization-url}",
            client_id: "{your-client-id}",
            client_secret: "{your-client-secret}",
            redirect_url: "{your-redirect-url}",
            scopes: [{your-array-of-scopes}],
  3. Include the authorization script in your project:

        <script src="libs/chrome-ex-oauth/oauth2.js"></script>
  4. To authorize the application from your script:

  5. Include attribution to library.



Starts the authorization process.


Retrieves the applications authorization token from the browsers local storage.


Clears the applications token from the browsers local storage.

This library has only been tested with the GitHub API v3