Only always use token types from tokens.js

This commit is contained in:
Johannes Zellner
2023-08-07 16:53:00 +02:00
parent 8f20a09791
commit e9f3f13564
7 changed files with 34 additions and 41 deletions
+9 -10
View File
@@ -68,6 +68,14 @@ var ROLES = {
USER: 'user'
};
// sync up with tokens.js
const TOKEN_TYPES = {
ID_WEBADMIN: 'cid-webadmin', // dashboard
ID_DEVELOPMENT: 'cid-development', // dashboard development
ID_CLI: 'cid-cli', // cloudron cli
ID_SDK: 'cid-sdk', // created by user via dashboard
};
// sync up with tasks.js
var TASK_TYPES = {
TASK_APP: 'app',
@@ -1895,15 +1903,6 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
});
};
Client.prototype.destroyOidcSession = function (callback) {
del('/api/v1/oidc/sessions', null, function (error, data, status) {
if (error) return callback(error);
if (status !== 204) return callback(new ClientError(status, data));
callback(null);
});
};
Client.prototype.getOidcClients = function (callback) {
get('/api/v1/oidc/clients', null, function (error, data, status) {
if (error) return callback(error);
@@ -2623,7 +2622,7 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
this.setToken(null);
// start oidc flow
window.location.href = this.apiOrigin + '/openid/auth?client_id=' + ('<%= apiOrigin %>' ? 'development' : 'dashboard') + '&scope=openid email profile&response_type=code token&redirect_uri=' + window.location.origin + '/authcallback.html';
window.location.href = this.apiOrigin + '/openid/auth?client_id=' + ('<%= apiOrigin %>' ? TOKEN_TYPES.ID_DEVELOPMENT : TOKEN_TYPES.ID_WEBADMIN) + '&scope=openid email profile&response_type=code token&redirect_uri=' + window.location.origin + '/authcallback.html';
};
Client.prototype.logout = function () {