OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Use the <code>chrome.identity</code> API to get OAuth2 access tokens. | 5 // Use the <code>chrome.identity</code> API to get OAuth2 access tokens. |
6 namespace identity { | 6 namespace identity { |
7 | 7 |
8 dictionary TokenDetails { | 8 dictionary TokenDetails { |
9 // Fetching a token may require the user to sign-in to Chrome, or | 9 // Fetching a token may require the user to sign-in to Chrome, or |
10 // approve the application's requested scopes. If the interactive | 10 // approve the application's requested scopes. If the interactive |
(...skipping 21 matching lines...) Expand all Loading... |
32 // loading a page meant to be displayed. | 32 // loading a page meant to be displayed. |
33 // | 33 // |
34 // If the interactive flag is <code>true</code>, the window will | 34 // If the interactive flag is <code>true</code>, the window will |
35 // be displayed when a page load completes. If the flag is | 35 // be displayed when a page load completes. If the flag is |
36 // <code>false</code> or omitted, <code>launchWebAuthFlow</code> | 36 // <code>false</code> or omitted, <code>launchWebAuthFlow</code> |
37 // will return with an error if the initial navigation does not | 37 // will return with an error if the initial navigation does not |
38 // complete the flow. | 38 // complete the flow. |
39 boolean? interactive; | 39 boolean? interactive; |
40 }; | 40 }; |
41 | 41 |
| 42 dictionary AccountInfo { |
| 43 // A unique identifier for the account. This ID will not change |
| 44 // for the lifetime of the account. |
| 45 DOMString id; |
| 46 // The email address associated with the account. APIs that return |
| 47 // <code>AccountInfo</code> objects will populate this field if |
| 48 // the app has the <code>identity.email</code> permission. |
| 49 DOMString? email; |
| 50 }; |
| 51 |
42 callback GetAuthTokenCallback = void (optional DOMString token); | 52 callback GetAuthTokenCallback = void (optional DOMString token); |
43 callback InvalidateAuthTokenCallback = void (); | 53 callback InvalidateAuthTokenCallback = void (); |
44 callback LaunchWebAuthFlowCallback = void (optional DOMString responseUrl); | 54 callback LaunchWebAuthFlowCallback = void (optional DOMString responseUrl); |
45 | 55 |
46 interface Functions { | 56 interface Functions { |
47 // Gets an OAuth2 access token using the client ID and scopes | 57 // Gets an OAuth2 access token using the client ID and scopes |
48 // specified in the <a | 58 // specified in the <a |
49 // href="app_identity.html#update_manifest"><code>oauth2</code> | 59 // href="app_identity.html#update_manifest"><code>oauth2</code> |
50 // section of manifest.json</a>. | 60 // section of manifest.json</a>. |
51 // | 61 // |
(...skipping 26 matching lines...) Expand all Loading... |
78 // first URL in the provider's auth flow. When the provider | 88 // first URL in the provider's auth flow. When the provider |
79 // redirects to a URL matching the pattern | 89 // redirects to a URL matching the pattern |
80 // <code>https://<app-id>.chromiumapp.org/*</code>, the | 90 // <code>https://<app-id>.chromiumapp.org/*</code>, the |
81 // window will close, and the final redirect URL will be passed to | 91 // window will close, and the final redirect URL will be passed to |
82 // the <var>callback</var> function. | 92 // the <var>callback</var> function. |
83 // | 93 // |
84 // |details| : WebAuth flow options. | 94 // |details| : WebAuth flow options. |
85 // |callback| : Called with the URL redirected back to your application. | 95 // |callback| : Called with the URL redirected back to your application. |
86 static void launchWebAuthFlow(WebAuthFlowDetails details, | 96 static void launchWebAuthFlow(WebAuthFlowDetails details, |
87 LaunchWebAuthFlowCallback callback); | 97 LaunchWebAuthFlowCallback callback); |
88 } | 98 }; |
89 ; | 99 |
| 100 interface Events { |
| 101 // Fired when signin state changes for an account on the user's profile. |
| 102 static void onSignInChanged(AccountInfo account, boolean signedIn); |
| 103 }; |
90 }; | 104 }; |
OLD | NEW |