How to use
#
Use the override configinfo
See all the functions that can be overrided here
- ReactJS
- Angular
- Vue
- Plain JavaScript
- React Native
Note
You can use the
You can refer to this example app as a reference for using the
supertokens-web-js
SDK which exposes several helper functions that query the APIs exposed by the SuperTokens backend SDK.You can refer to this example app as a reference for using the
supertokens-web-js
SDK.Note
To use SuperTokens with React Native you need to use the
To add login functionality, you need to build your own UI and call the APIs exposed by the backend SDKs. You can find the API spec here
supertokens-react-native
SDK. The SDK provides session management features.To add login functionality, you need to build your own UI and call the APIs exposed by the backend SDKs. You can find the API spec here
What type of UI are you using?
Prebuilt UICustom UI
What type of UI are you using?
Prebuilt UICustom UI
import SuperTokens from "supertokens-auth-react";import ThirdPartyPasswordless from "supertokens-auth-react/recipe/thirdpartypasswordless";
SuperTokens.init({ appInfo: { apiDomain: "...", appName: "...", websiteDomain: "..." }, recipeList: [ ThirdPartyPasswordless.init({ contactMethod: "EMAIL", // This example will work with any contactMethod override: { functions: (originalImplementation) => { return { ...originalImplementation, // we will only be overriding what happens when a user // enters the OTP or clicks on the magic link consumePasswordlessCode: async function (input) { // TODO: some custom logic
// or call the default behaviour as show below return originalImplementation.consumePasswordlessCode(input); }, // ... // TODO: override more functions } } } }) ]});
originalImplementation
is an object that contain functions that have the original implementation for this recipe. They can be used in your functions as a way to use the SuperTokens' default behaviour.- In the above code snippet, we override the
consumeCode
function of this recipe. This means that when the user clicks enters the OTP or clicks on the magic link, your function will be called with the relevantinput
object.