misc small fixes

This commit is contained in:
tigerbot 2017-06-23 17:47:04 -06:00
parent 3ac0f3077e
commit 403ec90c2d
3 changed files with 13 additions and 8 deletions

View File

@ -11,7 +11,12 @@ angular.module('com.daplie.cloud', [ 'org.oauth3' ])
return Oauth3.PromiseA.resolve(session); return Oauth3.PromiseA.resolve(session);
}; };
var auth = Oauth3.create(); var auth = Oauth3.create();
auth.setProvider('oauth3.org'); auth.setProvider('oauth3.org').then(function () {
auth.checkSession().then(function (session) {
console.log('hasSession?', session);
});
});
window.oauth3 = auth; // debug window.oauth3 = auth; // debug
return auth; return auth;
} ]) } ])
@ -139,8 +144,13 @@ angular.module('com.daplie.cloud', [ 'org.oauth3' ])
vm.authenticate = function () { vm.authenticate = function () {
// TODO authorization redirect /api/org.oauth3.consumer/authorization_redirect/:provider_uri // TODO authorization redirect /api/org.oauth3.consumer/authorization_redirect/:provider_uri
var opts = {
type: 'popup'
, scope: 'domains,dns'
// , debug: true
};
return oauth3.authenticate().then(function (session) { return oauth3.authenticate(opts).then(function (session) {
console.info("Authorized Session", session); console.info("Authorized Session", session);
return oauth3.api('domains.list').then(function (domains) { return oauth3.api('domains.list').then(function (domains) {
@ -249,10 +259,6 @@ angular.module('com.daplie.cloud', [ 'org.oauth3' ])
}); });
}; };
oauth3.checkSession().then(function (session) {
console.log('hasSession?', session);
});
/* /*
console.log('OAUTH3.PromiseA', OAUTH3.PromiseA); console.log('OAUTH3.PromiseA', OAUTH3.PromiseA);
return oauth3.setProvider('oauth3.org').then(function () { return oauth3.setProvider('oauth3.org').then(function () {

View File

@ -93,7 +93,6 @@ module.exports.create = function (deps, config) {
} }
}; };
console.log(directives);
return OAUTH3.api(directives.api, opts).then(function (result) { return OAUTH3.api(directives.api, opts).then(function (result) {
console.log('got a token from the tunnel server?'); console.log('got a token from the tunnel server?');
result.owner = owner; result.owner = owner;

View File

@ -138,7 +138,7 @@ module.exports.create = function (deps, conf) {
return scmp(tid, token.id); return scmp(tid, token.id);
})) { })) {
console.log('adds new owner with existing owner'); console.log('adds new owner with existing owner');
return deps.storage.owners.set(id, session); return deps.storage.owners.set(tid, session);
} }
}).then(function () { }).then(function () {
res.setHeader('Content-Type', 'application/json;'); res.setHeader('Content-Type', 'application/json;');