mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 02:51:12 -05:00
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
/**
|
|
* Auth0 Provider Wrapper
|
|
*
|
|
* Wraps the Auth0Provider from @auth0/auth0-react with our configuration
|
|
*/
|
|
|
|
import { Auth0Provider as Auth0ProviderBase } from '@auth0/auth0-react';
|
|
import { auth0Config, isAuth0Configured } from '@/lib/auth0Config';
|
|
import { ReactNode } from 'react';
|
|
|
|
interface Auth0ProviderWrapperProps {
|
|
children: ReactNode;
|
|
}
|
|
|
|
export function Auth0Provider({ children }: Auth0ProviderWrapperProps) {
|
|
// If Auth0 is not configured, render children without Auth0 provider
|
|
// This allows gradual migration from Supabase auth
|
|
if (!isAuth0Configured()) {
|
|
console.warn('[Auth0] Auth0 not configured, skipping Auth0 provider');
|
|
return <>{children}</>;
|
|
}
|
|
|
|
return (
|
|
<Auth0ProviderBase
|
|
domain={auth0Config.domain}
|
|
clientId={auth0Config.clientId}
|
|
authorizationParams={auth0Config.authorizationParams}
|
|
cacheLocation={auth0Config.cacheLocation}
|
|
useRefreshTokens={auth0Config.useRefreshTokens}
|
|
useRefreshTokensFallback={auth0Config.useRefreshTokensFallback}
|
|
>
|
|
{children}
|
|
</Auth0ProviderBase>
|
|
);
|
|
}
|