Skip to content

Commit fa626e5

Browse files
committed
Update KeycloakService.ts
1 parent 70be2e1 commit fa626e5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

forms-flow-service/src/keycloak/KeycloakService.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ import Keycloak, {
117117
.then((authenticated) => {
118118
if (authenticated) {
119119
console.log("Authenticated");
120-
if (!!this.kc?.resourceAccess) {
121-
const UserRoles = this.kc?.resourceAccess[this.kc.clientId!]?.roles;
120+
const tokenParsed = this.kc.tokenParsed || {};
121+
const UserRoles = tokenParsed.roles || tokenParsed.role || tokenParsed.client_roles || [];
122+
if (UserRoles.length > 0) {
122123
if(!UserRoles){
123124
callback(false);
124125
}

0 commit comments

Comments
 (0)