Authenticate users into a web2 database to build a hybrid web2+web3 creator platform!

Overview

Creator Platform

This project demonstrates how you can connect your web2 backend and integrate it with web3 using sign in with ethereum.

Tools:

  • React SDK: To access the connected wallet, switch the user's network, and claim an NFT from our Edition Drop collection.
  • Auth: To ask users to sign a message and verify they own the wallet they claim to be, while on the server-side.

Using This Template

Create a project using this example:

npx thirdweb create --template creator-platform
  • Add your wallet's private key as an environment variable in a .env.local file called PRIVATE_KEY:
  • Create a project on mongoDB.
  • Create a new database in your mongoDB project, copy the connection url and add it in .env.local file.
PRIVATE_KEY=your-wallet-private-key
DATABASE_URL=mongodb-connection-url

How It Works

Using Auth, we ask users to sign in using their web3 wallet. Once they sign in, we show them some inputs to create their profile. Then, we make an api call and save the user's profile in the database.

We need to create a configuration file that contains our wallet's private key (used to generate messages for users to sign) and our site's domain name:

This file is called auth.config.js and is at the root of the project.

import { ThirdwebAuth } from "@thirdweb-dev/auth/next";
import { domainName } from "./const/yourDetails";

export const { ThirdwebAuthHandler, getUser } = ThirdwebAuth({
  privateKey: process.env.PRIVATE_KEY || "",
  domain: domainName,
});

Finally, we have a catch-all API route called pages/api/auth/[...thirdweb].js, which exports the ThirdwebAuthHandler to manage all of the required auth endpoints like login and logout.

import { ThirdwebAuthHandler } from "../../../auth.config";

export default ThirdwebAuthHandler();

Setting Up the Auth SDK

Inside the _app.jsx file, we configure the Auth SDK in the ThirdwebProvider component that wraps our application, allowing us to use the hooks of the SDK throughout our application:

Join our Discord!

For any questions, suggestions, join our discord at https://discord.gg/thirdweb.

You might also like...

Smooth mobile touch slider for Mobile WebApp, HTML5 App, Hybrid App

Smooth mobile touch slider for Mobile WebApp, HTML5 App, Hybrid App

iSlider iSlider is a lightweight, high-performant, no library dependencies cross-platform slide controller. It can help handling most sliding effects,

Nov 25, 2022

Selectize is the hybrid of a textbox and select box

Selectize is the hybrid of a textbox and select box

Selectize is the hybrid of a textbox and select box. It's jQuery based, and it has autocomplete and native-feeling keyboard navigation; useful for tagging, contact lists, etc.

Jan 5, 2023

Visualize, modify, and build your database with dbSpy! An open-source data modeling tool to facilitate relational database development.

Visualize, modify, and build your database with dbSpy! An open-source data modeling tool to facilitate relational database development.

Visualize, modify, and build your database with dbSpy! dbSpy is an open-source data modeling tool to facilitate relational database development. Key F

Dec 22, 2022

A free and open-source Automatic Account Creator (AAC) written in Javascript Stack;

A free and open-source Automatic Account Creator (AAC) written in Javascript Stack;

A free and open-source Automatic Account Creator (AAC) written in Javascript Stack. 👨🏾‍💻 Techs Front-end Vue.js Vuex-module-decorators Vuetify.js N

Dec 17, 2022

TRAB is a Chrome extension that gives you a single button to mark tweet as spam, and block the tweet's creator

TRAB is a Chrome extension that gives you a single button to mark tweet as spam, and block the tweet's creator

TRAB - Tweet Reporter and Blocker TRAB is a Chrome extension that gives you a single button to do two things with a single click: Mark a Tweet as spam

May 4, 2022

Official fork of XREngine for The Nexus by the creator of XREngine.

Nexus Engine Official fork of XREngine for The Nexus by the creator of XREngine. Web3-enabled, ethically run, interoperability focused, always free an

Feb 23, 2022

Powerd by Cocos Creator 3.4.2

Powerd by Cocos Creator 3.4.2

Cocos_Fc_Tank Powerd by Cocos Creator 3.4.2 and https://github.com/ocfbnj/CocosCreatorTank 1.疫情封在家,学一学Cocos Creator,边学边做,索性就把ocfbnj的老项目移植到Cocos Creato

Oct 31, 2022
Owner
thirdweb templates
thirdweb templates
Cross platform UI controls for progressive web and hybrid apps (plain JS, jQuery, Angular and React)

Mobiscroll What is Mobiscroll? Mobiscroll is a UI library for progressive webapps and hybrid development. Created with a lot of attention to usability

Mobiscroll 1.5k Dec 31, 2022
Authenticate your Replit Users without ReplAuth.

Replit Login An unofficial way to authenticate your Replit users Authenticate Replit users in your projects without ReplAuth. This uses the actual Rep

Ray 8 Aug 11, 2022
Web3-citizens-app - React application based on smart contract using web3 and MetaMask extention.

Citizens App (web3-react-redux) React application based on smart contract using web3 and MetaMask extention. Start the applicarion Recomend to install

Denys Voloshyn 3 Aug 25, 2022
A web3 starter project using Typescript, Hardhat, ethers.js and @web3-react

Starter React Typescript Ethers.js Hardhat Project This repo contains a Hardhat and React Dapp starter project. The React Dapp in the frontend dir of

ChainShot 39 Dec 31, 2022
(🔗, 🌲) Web3 Link Tree is a free & open-source alternative to Linktree built with React.js, Next.js, Tailwind and Web3-React

Getting Started Read the detailed guide here Customize Add your name, wallet address, social media links and more in config.ts Images Save images to t

Naut 35 Sep 20, 2022
🛠 Solana Web3 Tools - A set of tools to improve the user experience on Web3 Solana Frontends.

?? Solana Web3 Tools - A set of tools to improve the user experience on Web3 Solana Frontends.

Holaplex 30 May 21, 2022
Tip Tweet is a hybrid dApp that provides a simple way to tip a tweet using Ethereum. Authors can claim their tips using their Twitter account. You only need the tweet URL to tip. 🚀 😎

Tip Tweet Table of Contents About Folder Structure Contract Deveopment Starting the App Usage Contributing About Tip Tweet is hybrid dApp that allows

Dias Junior 23 Nov 15, 2022
Utility for authorizing user in a connected app, creating JWT to authenticate against it, and perform a sample callout.

Question: What is this for? Answer: When configuring a Salesforce Connected app to use certificates to authenticate you will use JSON Web Tokens to a

null 4 Jun 15, 2022
Building block for hybrid Deno/Node scaffolding tools

Skaffe—building block for hybrid scaffolding tools This library provides a simple way to copy around files that were shipped with your hybrid Deno/Nod

KnorpelSenf 2 Aug 2, 2022
Generate a secured base32 one time password to authenticate your user! 🔐

Django SOTP ?? Generate a secured base32 one time password to authenticate your user! Case Study ?? Before I mention why you should use django-sotp in

アブラム (Abram) 36 Dec 22, 2022