nokiny
02/10/2024, 7:34 PMrp_st
02/10/2024, 7:37 PMrp_st
02/10/2024, 7:37 PMnokiny
02/10/2024, 7:38 PMnokiny
02/10/2024, 7:38 PMrp_st
02/10/2024, 7:39 PMnokiny
02/10/2024, 7:39 PMrp_st
02/10/2024, 7:40 PMnokiny
02/10/2024, 7:40 PMnokiny
02/10/2024, 7:44 PMnokiny
02/10/2024, 7:47 PMnokiny
02/10/2024, 8:01 PMjs
SuperTokens.init({
appInfo: {
apiDomain: 'http://localhost:3000',
apiBasePath: '/api',
appName: 'Seat Insights',
},
recipeList: [Session.init(), EmailPassword.init({})],
});
nodejs backend:
js
supertokens.init({
framework: "express",
supertokens: {
connectionURI: process.env.SUPER_TOKEN_CONNECTION_URI,
apiKey: process.env.SUPER_TOKEN_CORE_API_KEY,
},
appInfo: {
appName: "Your App Name",
apiDomain: process.env.API_DOMAIN || "http://localhost:3000",
websiteDomain: process.env.FRONTEND_URL || "http://localhost:4200",
apiBasePath: "/api",
},
recipeList: [
EmailPassword.init({
signUpFeature: {
signUpForm: {
formFields: [
{
id: "name",
label: "Full name",
placeholder: "First name and last name",
},
],
},
},
override: {
functions: (originalImplementation) => {
return {
...originalImplementation,
signUp: async function (input) {
// First we call the original implementation of signUpPOST.
let response = await originalImplementation.signUp(input);
// Post sign up response, we check if it was successful
if (
response.status === "OK" &&
response.user.loginMethods.length === 1
) {
/**
*
* response.user contains the following info:
* - emails
* - id
* - timeJoined
* - tenantIds
* - phone numbers
* - third party login info
* - all the login methods associated with this user.
* - information about if the user's email is verified or not.
*
*/
// TODO: post sign up logic
console.log(response);
}
return response;
},
};
},
},
}),
Session.init(), // Initializes session features
Dashboard.init(), // Initializes dashboard features
UserMetadata.init(),
],
});
nokiny
02/10/2024, 8:02 PMrp_st
02/10/2024, 8:02 PMrp_st
02/10/2024, 8:02 PMrp_st
02/10/2024, 8:03 PMnokiny
02/10/2024, 8:03 PMnokiny
02/10/2024, 8:03 PMjs
let response = await signUp({
formFields: [
{
id: 'email',
value: this.userInput['email'].currentValue,
},
{
id: 'password',
value: this.userInput['password'].currentValue,
},
{
id: 'name',
value: `${this.userInput['firstName'].currentValue} ${this.userInput['lastName'].currentValue}`,
},
],
});
rp_st
02/10/2024, 8:05 PMSuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).
Powered by