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