use oauth url with origin & fix http requests

This commit is contained in:
Dan Percic 2023-07-07 12:07:19 +03:00
parent f631395f61
commit 30846478ed
2 changed files with 8 additions and 2 deletions

View File

@ -58,7 +58,7 @@ export abstract class GenericService<I> {
let path = `/${this._serviceName}/${encodeURI(modelPath)}`;
if (typeof body === 'string') {
path += `/${this._serviceName}/${encodeURIComponent(body)}`;
path += `/${encodeURIComponent(body)}`;
}
return this._http.delete(path, {

View File

@ -7,9 +7,15 @@ import { NGXLogger } from 'ngx-logger';
import { Router } from '@angular/router';
export function getKeycloakOptions(baseUrl: string, config: IqserAppConfig, tenant: string): KeycloakOptions {
let oauthUrl = config.OAUTH_URL;
if (!oauthUrl.startsWith('http')) {
oauthUrl = oauthUrl.startsWith('/') ? oauthUrl : '/' + oauthUrl;
oauthUrl = window.location.origin + oauthUrl;
}
return {
config: {
url: config.OAUTH_URL,
url: oauthUrl,
realm: tenant,
clientId: config.OAUTH_CLIENT_ID,
},