OLD | NEW |
| (Empty) |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 /** | |
6 * @fileoverview | |
7 * OAuth2 API flow implementations. | |
8 */ | |
9 | |
10 'use strict'; | |
11 | |
12 /** @suppress {duplicate} */ | |
13 var remoting = remoting || {}; | |
14 | |
15 /** @interface */ | |
16 remoting.OAuth2Api = function() { | |
17 }; | |
18 | |
19 /** | |
20 * Asynchronously retrieves a new access token from the server. | |
21 * | |
22 * @param {function(string, number): void} onDone Callback to invoke when | |
23 * the access token and expiration time are successfully fetched. | |
24 * @param {function(!remoting.Error):void} onError Callback invoked if an | |
25 * error occurs. | |
26 * @param {string} clientId OAuth2 client ID. | |
27 * @param {string} clientSecret OAuth2 client secret. | |
28 * @param {string} refreshToken OAuth2 refresh token to be redeemed. | |
29 * @return {void} Nothing. | |
30 */ | |
31 remoting.OAuth2Api.prototype.refreshAccessToken = function( | |
32 onDone, onError, clientId, clientSecret, refreshToken) { | |
33 }; | |
34 | |
35 /** | |
36 * Asynchronously exchanges an authorization code for access and refresh tokens. | |
37 * | |
38 * @param {function(string, string, number): void} onDone Callback to | |
39 * invoke when the refresh token, access token and access token expiration | |
40 * time are successfully fetched. | |
41 * @param {function(!remoting.Error):void} onError Callback invoked if an | |
42 * error occurs. | |
43 * @param {string} clientId OAuth2 client ID. | |
44 * @param {string} clientSecret OAuth2 client secret. | |
45 * @param {string} code OAuth2 authorization code. | |
46 * @param {string} redirectUri Redirect URI used to obtain this code. | |
47 * @return {void} Nothing. | |
48 */ | |
49 remoting.OAuth2Api.prototype.exchangeCodeForTokens = function( | |
50 onDone, onError, clientId, clientSecret, code, redirectUri) { | |
51 }; | |
52 | |
53 /** | |
54 * Get the user's email address. | |
55 * | |
56 * TODO(jamiewalch): Reorder these parameters to match the typical chrome API | |
57 * convention of having callbacks at the end and remove the token parameter | |
58 * to match remoting.HostListApi. | |
59 * | |
60 * @param {function(string):void} onDone Callback invoked when the email | |
61 * address is available. | |
62 * @param {function(!remoting.Error):void} onError Callback invoked if an | |
63 * error occurs. | |
64 * @param {string} token Access token. | |
65 * @return {void} Nothing. | |
66 */ | |
67 remoting.OAuth2Api.prototype.getEmail = function(onDone, onError, token) { | |
68 }; | |
69 | |
70 /** | |
71 * Get the user's email address and full name. | |
72 * | |
73 * @param {function(string, string):void} onDone Callback invoked when the email | |
74 * address and full name are available. | |
75 * @param {function(!remoting.Error):void} onError Callback invoked if an | |
76 * error occurs. | |
77 * @param {string} token Access token. | |
78 * @return {void} Nothing. | |
79 */ | |
80 remoting.OAuth2Api.prototype.getUserInfo = function(onDone, onError, token) { | |
81 }; | |
OLD | NEW |