Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Check for empty string when user tries to set custom accessTokenExpir…
Browse files Browse the repository at this point in the history
…eCookieName
  • Loading branch information
davidprae committed Feb 22, 2024
1 parent 2cc7a94 commit c4688a9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/providers/FusionAuthProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,17 @@ export const FusionAuthProvider: React.FC<FusionAuthConfig> = props => {
const [user, setUser] = useState<User>({});
const isAuthenticated = useMemo(() => Object.keys(user).length > 0, [user]);

const accessTokenExpireCookieName = useMemo(
() => props.accessTokenExpireCookieName ?? 'app.at_exp',
[props.accessTokenExpireCookieName],
);
const accessTokenExpireCookieName = useMemo(() => {
if (props.accessTokenExpireCookieName?.length) {
return props.accessTokenExpireCookieName;
}

console.warn(
'Cannot set access token cookie name to empty string. Using default value.',
);

return 'app.at_exp';
}, [props.accessTokenExpireCookieName]);

const generateServerUrl = useCallback(
(
Expand Down

0 comments on commit c4688a9

Please sign in to comment.