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 3d843b2 commit 2413a68
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/services/AuthService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ const Auth = ({ children }: GenericContextProviderProps) => {
);

const tokenRefresh = useCallback(() => {
if (!initialized || 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 @@ -306,9 +306,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 2413a68

Please sign in to comment.