OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * OAuth2 class that handles retrieval/storage of an OAuth2 token. | 7 * OAuth2 class that handles retrieval/storage of an OAuth2 token. |
8 * | 8 * |
9 * Uses a content script to trampoline the OAuth redirect page back into the | 9 * Uses a content script to trampoline the OAuth redirect page back into the |
10 * extension context. This works around the lack of native support for | 10 * extension context. This works around the lack of native support for |
(...skipping 16 matching lines...) Expand all Loading... |
27 // Constants representing keys used for storing persistent state. | 27 // Constants representing keys used for storing persistent state. |
28 /** @private */ | 28 /** @private */ |
29 remoting.OAuth2.prototype.KEY_REFRESH_TOKEN_ = 'oauth2-refresh-token'; | 29 remoting.OAuth2.prototype.KEY_REFRESH_TOKEN_ = 'oauth2-refresh-token'; |
30 /** @private */ | 30 /** @private */ |
31 remoting.OAuth2.prototype.KEY_ACCESS_TOKEN_ = 'oauth2-access-token'; | 31 remoting.OAuth2.prototype.KEY_ACCESS_TOKEN_ = 'oauth2-access-token'; |
32 /** @private */ | 32 /** @private */ |
33 remoting.OAuth2.prototype.KEY_EMAIL_ = 'remoting-email'; | 33 remoting.OAuth2.prototype.KEY_EMAIL_ = 'remoting-email'; |
34 | 34 |
35 // Constants for parameters used in retrieving the OAuth2 credentials. | 35 // Constants for parameters used in retrieving the OAuth2 credentials. |
36 /** @private */ | 36 /** @private */ |
37 remoting.OAuth2.prototype.CLIENT_ID_ = | |
38 '440925447803-2pi3v45bff6tp1rde2f7q6lgbor3o5uj.' + | |
39 'apps.googleusercontent.com'; | |
40 /** @private */ | |
41 remoting.OAuth2.prototype.CLIENT_SECRET_ = 'W2ieEsG-R1gIA4MMurGrgMc_'; | |
42 /** @private */ | |
43 remoting.OAuth2.prototype.SCOPE_ = | 37 remoting.OAuth2.prototype.SCOPE_ = |
44 'https://www.googleapis.com/auth/chromoting ' + | 38 'https://www.googleapis.com/auth/chromoting ' + |
45 'https://www.googleapis.com/auth/googletalk ' + | 39 'https://www.googleapis.com/auth/googletalk ' + |
46 'https://www.googleapis.com/auth/userinfo#email'; | 40 'https://www.googleapis.com/auth/userinfo#email'; |
47 /** @private */ | 41 /** @private */ |
48 remoting.OAuth2.prototype.OAUTH2_TOKEN_ENDPOINT_ = | 42 remoting.OAuth2.prototype.OAUTH2_TOKEN_ENDPOINT_ = |
49 'https://accounts.google.com/o/oauth2/token'; | 43 'https://accounts.google.com/o/oauth2/token'; |
50 | 44 |
51 /** @return {boolean} True if the app is already authenticated. */ | 45 /** @return {boolean} True if the app is already authenticated. */ |
52 remoting.OAuth2.prototype.isAuthenticated = function() { | 46 remoting.OAuth2.prototype.isAuthenticated = function() { |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 * @return {?string} The email address, if it has been cached by a previous call | 330 * @return {?string} The email address, if it has been cached by a previous call |
337 * to getEmail, otherwise null. | 331 * to getEmail, otherwise null. |
338 */ | 332 */ |
339 remoting.OAuth2.prototype.getCachedEmail = function() { | 333 remoting.OAuth2.prototype.getCachedEmail = function() { |
340 var value = window.localStorage.getItem(this.KEY_EMAIL_); | 334 var value = window.localStorage.getItem(this.KEY_EMAIL_); |
341 if (typeof value == 'string') { | 335 if (typeof value == 'string') { |
342 return value; | 336 return value; |
343 } | 337 } |
344 return null; | 338 return null; |
345 }; | 339 }; |
OLD | NEW |