Warning
Deprecated. This example wires NextAuth.js to the @telegram-auth/* packages, which are deprecated in favour of Telegram's OpenID Connect login.
Telegram publishes an OIDC discovery document, so the AuthDataValidator wiring this example demonstrates is no longer needed.
→ Wiring it up in the migration guide.
Kept for reference only; it is not maintained.
-
Clone the repository
git clone https://github.com/manzoorwanijk/telegram-auth.git cd telegram-auth -
Install and build dependencies
pnpm install pnpm kick-off
-
Go to the next-auth example folder
cd examples/next-auth -
Create a
.env.localfile by copying.example.env.localand updateBOT_TOKENandBOT_USERNAMEwith your bot's token and username that you got from @BotFather. -
Start the dev server
pnpm run dev
-
You may want to use ngrok to expose your local server to the internet.
ngrok http 3000
Copy the ngrok URL and update
NEXTAUTH_URLin.env.localwith it.Don't forget to send
/setdomaincommand to @BotFather with the ngrok URL to fix the "Bot domain invalid" error.