2017-03-16 05:48:39 +00:00
|
|
|
;(function (exports) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var OAUTH3 = exports.OAUTH3 = exports.OAUTH3 || require('./oauth3.core.js').OAUTH3;
|
|
|
|
|
|
|
|
OAUTH3.api['tunnel.token'] = function (providerUri, opts) {
|
|
|
|
var session = opts.session;
|
|
|
|
|
|
|
|
return OAUTH3.request({
|
|
|
|
method: 'POST'
|
|
|
|
, url: OAUTH3.url.normalize(providerUri)
|
2017-08-15 20:21:54 +00:00
|
|
|
+ '/api/tunnel@oauth3.org/accounts/' + session.token.sub + '/token'
|
2017-03-16 05:48:39 +00:00
|
|
|
, session: session
|
|
|
|
, data: {
|
|
|
|
domains: opts.data.domains
|
|
|
|
, device: opts.data.device
|
|
|
|
}
|
|
|
|
}).then(function (res) {
|
|
|
|
return res.data.records || res.data;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
}('undefined' !== typeof exports ? exports : window));
|