Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dudiiiiiiii committed Oct 15, 2024
1 parent 23c658c commit 020869c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/services/AuthService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,7 @@ const Auth = ({ children }: GenericContextProviderProps) => {
);

const tokenRefresh = useCallback(() => {
if (!initialized || !keycloak.authenticated || user?.source !== 'keycloak')
return Promise.resolve();
if (!initialized || user?.source !== 'keycloak') return Promise.resolve();

return keycloak
.updateToken(300) // 5 minutes in seconds minimum remaining lifetime for token before refresh is allowed
Expand All @@ -309,9 +308,7 @@ const Auth = ({ children }: GenericContextProviderProps) => {

useIntervalAsync(
tokenRefresh,
initialized && keycloak.authenticated && keycloak.isTokenExpired()
? keyCloakInterval
: undefined
initialized && keycloak.authenticated ? keyCloakInterval : undefined
);

const refresh = useCallback(async () => {
Expand Down

0 comments on commit 020869c

Please sign in to comment.