Skip to content

Commit 7e82bd7

Browse files
authored
Merge pull request #488 from shuhaib-aot/Bufix/FWF-4415-fix-logout-issue
FWF-4415 [bug] fixed auto logout issue in new user
2 parents 818ab0b + 32f646b commit 7e82bd7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ import Keycloak, {
117117
.then((authenticated) => {
118118
if (authenticated) {
119119
console.log("Authenticated");
120-
const tokenParsed = this.kc.tokenParsed || {};
121-
const UserRoles = tokenParsed.roles || tokenParsed.role || tokenParsed.client_roles || [];
122-
if (UserRoles.length > 0) {
120+
const tokenParsed = this.kc.tokenParsed;
121+
if(tokenParsed){
122+
const UserRoles = tokenParsed.roles || tokenParsed.role || tokenParsed.client_roles;
123123
if(!UserRoles){
124124
callback(false);
125125
}
@@ -138,10 +138,10 @@ import Keycloak, {
138138
});
139139
this.refreshToken();
140140
}
141-
}
142-
else {
141+
}else{
143142
this.logout();
144143
}
144+
145145
} else {
146146
console.warn("not authenticated!");
147147
this.login();

0 commit comments

Comments
 (0)