c7a00ea283
Currently the webadmin has a fixed built-in client id, which is added on server startup.
26 lines
798 B
JavaScript
Executable File
26 lines
798 B
JavaScript
Executable File
'use strict';
|
|
|
|
function LoginController ($scope, Client) {
|
|
console.debug('LoginController');
|
|
|
|
// manually tell yellowtent to manage the signInButton
|
|
window.yellowtent.setupButton(document.getElementById('signInButton'), function (authCode) {
|
|
if (!authCode) {
|
|
console.error('User did not finish the OAuth flow.');
|
|
return;
|
|
}
|
|
|
|
console.debug('Got authCode as result of OAuth flow.', authCode);
|
|
|
|
Client.exchangeCodeForToken(authCode, function (error, accessToken) {
|
|
if (error) {
|
|
console.error('Unable to exchange code for an access token.', error);
|
|
return;
|
|
}
|
|
|
|
localStorage.token = accessToken;
|
|
window.location.href = '#/volumelist';
|
|
});
|
|
});
|
|
}
|