mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 06:11:11 -05:00
Implement Auth0 migration
This commit is contained in:
35
src/contexts/Auth0Provider.tsx
Normal file
35
src/contexts/Auth0Provider.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user