phenomenal_moose_56739
cheerful_lemur_45830
authorisationUrlGET
signInUpPOST
kiesker
import { SuperTokensConfig, PreBuiltUIList } from './database/auth/supertoken'; import SuperTokens, { SuperTokensWrapper } from "supertokens-auth-react"; import { Routes, BrowserRouter as Router, Route } from "react-router-dom"; import { getSuperTokensRoutesForReactRouterDom } from 'supertokens-auth-react/ui' import { SessionAuth, SessionContext } from "supertokens-auth-react/recipe/session" //Components import Navbar from './components/nav/Navbar'; import NavbarAuth from './components/nav/NavbarAuth'; //Free Routes import Home from './routes/free/Home'; //Protected User Routes import Profile from './routes/user/Profile'; //Protecte Admin Routes SuperTokens.init(SuperTokensConfig); function App() { //Here const check = SessionContext; return ( <SuperTokensWrapper> <div className='App app-container'> <Router> {check ? <Navbar /> : <NavbarAuth />} <Routes> {/* This shows the login UI on "/auth" route */} {getSuperTokensRoutesForReactRouterDom(require("react-router-dom"), PreBuiltUIList)} {/* Unprotected route */} <Route path="/" element={<Home />} /> {/* Unprotected route */} {/* Protected route Users */} <Route path="/profile" element={ /* This protects the "/" route so that it shows <Home /> only if the user is logged in. Else it redirects the user to "/auth" */ <SessionAuth> <Profile /> </SessionAuth> } /> {/* Protected route Users */} </Routes> </Router> </div> </SuperTokensWrapper> ); } export default App;
Smultar
core
nextjs
majskiy
thirdPartySignInAndUp
candice07251
Kranos
useShadowDom: false
import SuperTokens from "supertokens-auth-react"; import ThirdPartyEmailPassword from "supertokens-auth-react/recipe/thirdpartyemailpassword"; SuperTokens.init({ appInfo: { apiDomain: "...", appName: "...", websiteDomain: "...", }, recipeList: [ ThirdPartyEmailPassword.init({ getRedirectionURL: async (context) => { if (context.action === "SUCCESS") { if (context.redirectToPath !== undefined) { // we are navigating back to where the user was before they authenticated return context.redirectToPath; } return "/dashboard"; } return undefined; } }), ] });
devcoelho
getUserById
getUsersByEmail
jam_nside
SuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).