Skip to content

Commit 1c47c16

Browse files
committed
Fixes 2 MRS auth issues
Change-Id: I26eef31e0b55ce3320ec53fb56fd025c2194efd8
1 parent cc7db7b commit 1c47c16

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

mrs_plugin/db_schema/default_static_content/index.html

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,6 @@
386386
try {
387387
response = await fetch(`${this.serviceUrl ?? ""}${input}`, {
388388
method,
389-
// eslint-disable-next-line @typescript-eslint/naming-convention
390-
headers: (this.accessToken !== undefined)
391-
? { Authorization: "Bearer " + this.accessToken }
392-
: undefined,
393389
body: (body !== undefined) ? JSON.stringify(body) : undefined,
394390
signal: controller.signal,
395391
});
@@ -485,7 +481,7 @@
485481
authApp,
486482
user: userName,
487483
nonce,
488-
sessionType: "bearer",
484+
sessionType: "cookie",
489485
},
490486
})).json();
491487

@@ -513,7 +509,7 @@
513509
authApp,
514510
username,
515511
password,
516-
sessionType: "bearer"
512+
sessionType: "cookie"
517513
},
518514
}, undefined, undefined, undefined, false);
519515

@@ -733,7 +729,7 @@
733729
const redirectUrl = encodeURIComponent(MrsBaseApp.getUrlWithNewSearchString(`authApp=${authApp}`));
734730

735731
globalThis.location.href =
736-
`${this.serviceUrl}/authentication/login?app=${authApp}&sessionType=bearer` +
732+
`${this.serviceUrl}/authentication/login?app=${authApp}&sessionType=cookie` +
737733
`&onCompletionRedirect=${redirectUrl}`;
738734
} else {
739735
globalThis.location.href = MrsBaseApp.getUrlWithNewSearchString();
@@ -1017,7 +1013,7 @@
10171013
const servicePath = currentLocation.searchParams.get("service");
10181014
const redirectUrl = currentLocation.searchParams.get("redirectUrl");
10191015
const ociUrl = `${currentLocation.protocol}//${currentLocation.host}${servicePath}/` +
1020-
`authentication/login?authApp=${appName}&sessionType=bearer&onCompletionRedirect=${redirectUrl}`
1016+
`authentication/login?authApp=${appName}&sessionType=cookie&onCompletionRedirect=${redirectUrl}`
10211017

10221018
return html`
10231019
<a href="${ociUrl}">
@@ -1101,7 +1097,7 @@
11011097
const fullRedirectUrl = encodeURIComponent(this.getUrlWithNewSearchString(
11021098
`authApp=${authApp}&redirectUrl=${redirectUrl}`));
11031099

1104-
const loginPath = `${serviceUrl}${authPath}/login?app=${authApp}&sessionType=bearer` +
1100+
const loginPath = `${serviceUrl}${authPath}/login?app=${authApp}&sessionType=cookie` +
11051101
`&onCompletionRedirect=${fullRedirectUrl}`;
11061102

11071103
window.location.href = loginPath;

mrs_plugin/examples/mrs_notes/src/myService.mrs.sdk/MrsBaseAppPreact.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export abstract class MrsBaseApp<Service extends MrsBaseService, State extends I
127127
// TODO: maybe we need a public API to add a token in the SDK
128128
this.mrsService.session.accessToken = accessToken;
129129
} else {
130+
this.mrsService.session.accessToken = accessToken;
130131
// If it was specified, store it in the globalThis.localStorage
131132
globalThis.localStorage.setItem(`${this.appName}JwtAccessToken`, accessToken);
132133
// Clean Browser URL without reloading the page

0 commit comments

Comments
 (0)