Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable oidc when offline #1101

Open
Grafikart opened this issue Mar 11, 2025 · 0 comments
Open

Disable oidc when offline #1101

Grafikart opened this issue Mar 11, 2025 · 0 comments

Comments

@Grafikart
Copy link

I'm trying to use oidc-react with an application that can work offline. But I have redirect even if offline. Is there a way to disable oidc when offline ? This is what I tried but it still try to redirect when offline. Did I miss something ?

export function OidcProvider({ children }: PropsWithChildren) {
    const isOnline = useOnline();
    if (!isOnline) {
        return (
            <AuthProvider
                userManager={undefined}
                authority={import.meta.env.VITE_AUTHORITY}
                clientId={import.meta.env.VITE_CLIENT_ID}
                redirectUri={import.meta.env.VITE_REDIRECT_URI}
                automaticSilentRenew={false}
                autoSignIn={false}
                autoSignOut={false}
            >
                {children}
            </AuthProvider>
        );
    }
    return (
        <AuthProvider
            userManager={isSSO ? userManager : undefined}
            onSignIn={onSignIn}
            authority={import.meta.env.VITE_AUTHORITY}
            clientId={import.meta.env.VITE_CLIENT_ID}
            redirectUri={import.meta.env.VITE_KEYCLOAK_REDIRECT_URI}
            automaticSilentRenew={true}
        >
            {children}
        </AuthProvider>
    );
}
@Grafikart Grafikart changed the title Disable signin redirect if offline Disable oidc when offline Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant