Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code samples are licensed under the BSD License.
?2013 Google
このページは大阪弁化フィルタによって翻訳生成されたんですわ。 |
Description: |
Use the chrome.identity API to get OAuth2 access tokens.
|
Availability: |
Stable since Chrome 29.
|
Permissions: |
"identity"
|
Learn More: |
Identify User
|
Gets an OAuth2 access token using the client ID and scopes specified in the oauth2
section of manifest.json.
The Identity API caches access tokens in memory, so it's ok to call getAuthToken
any time a token is required. The token cache automatically handles expiration.
true
, getAuthToken
will prompt the user as necessary. When the flag is false
or ommitted, getAuthToken
will return failure any time a prompt would be required.
The callback parameter should specify a function that looks like this:
function(string token) {...};
Removes an OAuth2 access token from the Identity API's token cache.
If an access token is discovered to be invalid, it should be passed to removeCachedAuthToken to remove it from the cache. The app may then retrieve a fresh token with getAuthToken
.
The callback parameter should specify a function that looks like this:
function() {...};
Starts an auth flow at the specified URL.
This method enables auth flows with non-Google identity providers by launching a web view and navigating it to the first URL in the provider's auth flow. When the provider redirects to a URL matching the pattern https://<app-id>.chromiumapp.org/*
, the window will close, and the final redirect URL will be passed to the callback function.
launchWebAuthFlow
hides its web view until the first navigation either redirects to the final URL, or finishes loading a page meant to be displayed.true
, the window will be displayed when a page load completes. If the flag is false
or ommitted, launchWebAuthFlow
will return with an error if the initial navigation does not complete the flow.
The callback parameter should specify a function that looks like this:
function(string responseUrl) {...};