This example demonstrates how to set up Telegram authentication using NextAuth.js along with other technologies such as Next.js, PrismaJS, Tailwind CSS, and ShadcnUI.
Follow these steps to get started with the Telegram authentication example:
-
Clone the Repository
git clone https://github.com/TeaByte/telegram-auth-nextjs.git cd telegram-auth-nextjs
-
Install Dependencies
npm install
-
Edit the
.env
FileUpdate the
BOT_TOKEN
andBOT_USERNAME
values in the.env
file with the data you obtained from @BotFather. -
Start the Development Server
npm run dev
-
Expose Your Local Server with ngrok
If you want to test the authentication over the internet, you can use ngrok to expose your local server:
ngrok http 3000
Copy the ngrok URL generated and update the
NEXTAUTH_URL
in the.env.local
file with it. Additionally, send the/setdomain
command to @BotFather with the ngrok URL to resolve the "Bot domain invalid" error.
Remember to replace placeholders and follow the instructions in the example to set up Telegram authentication for your Next.js application. This example combines the power of NextAuth.js, PrismaJS, Tailwind CSS, and ShadcnUI to create a seamless authentication experience using Telegram.