|
|
@ -11,7 +11,12 @@ angular.module('com.daplie.cloud', [ 'org.oauth3' ]) |
|
|
|
return Oauth3.PromiseA.resolve(session); |
|
|
|
}; |
|
|
|
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
|
|
|
|
return auth; |
|
|
|
} ]) |
|
|
@ -139,8 +144,13 @@ angular.module('com.daplie.cloud', [ 'org.oauth3' ]) |
|
|
|
|
|
|
|
vm.authenticate = function () { |
|
|
|
// 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); |
|
|
|
|
|
|
|
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); |
|
|
|
return oauth3.setProvider('oauth3.org').then(function () { |
|
|
|