Add SuperTokens authentication integration
- Install supertokens-auth-react, supertokens-node, supertokens-web-js - Create frontend and backend SuperTokens configuration - Add API route handler for auth endpoints - Add SuperTokensProvider wrapper in root layout - Create new auth component with SuperTokens UI - Configure Google and GitHub OAuth providers - Ready for SuperTokens core deployment Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
20
app/components/SuperTokensAuthComponent.tsx
Normal file
20
app/components/SuperTokensAuthComponent.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { redirectToAuth } from "supertokens-auth-react";
|
||||
import { ThirdPartyEmailPasswordPreBuiltUI } from "supertokens-auth-react/recipe/thirdpartyemailpassword/prebuiltui";
|
||||
import { canHandleRoute, getRoutingComponent } from "supertokens-auth-react/ui";
|
||||
|
||||
export default function SuperTokensAuthComponent() {
|
||||
useEffect(() => {
|
||||
if (!canHandleRoute([ThirdPartyEmailPasswordPreBuiltUI])) {
|
||||
redirectToAuth();
|
||||
}
|
||||
}, []);
|
||||
|
||||
if (canHandleRoute([ThirdPartyEmailPasswordPreBuiltUI])) {
|
||||
return getRoutingComponent([ThirdPartyEmailPasswordPreBuiltUI]);
|
||||
}
|
||||
|
||||
return <div>Loading...</div>;
|
||||
}
|
||||
Reference in New Issue
Block a user