Back

how can we use appwrite auth for the backend?

  • 0
  • Users
  • Web
varundeva
12 Jun, 2023, 06:48

Hello

I have a MERN application. Currently using auth in the backend sending jwt to React frontend.

Each api call in express server validates the jwt before sending response.

Can i replace entire auth with appwrite?

/register and /login should be replaced by appwrite. Means when /register calls from frontend backend should use appwrite. When /login calls by react app backend express should check user in appwrite and create the jwt and should send to frontend.

Is this possible?

TL;DR
OP is asking if they can replace their current authentication system in their MERN application with Appwrite. They want to use Appwrite to handle registration and login requests. They are looking for guidance on how to implement this using the Appwrite server SDK. There is no clear solution provided in the thread.
Sandeep K. Dasari
12 Jun, 2023, 06:56

It wont depend on the route, After you hit the route, Write a controller which calls the server SDK of appwrite.

Sandeep K. Dasari
12 Jun, 2023, 06:57
Sandeep K. Dasari
12 Jun, 2023, 06:57

this is the intro for server sdk

Sandeep K. Dasari
12 Jun, 2023, 06:58

https://appwrite.io/docs/server/users This is the section you need to study to implement authentication.

Sandeep K. Dasari
12 Jun, 2023, 06:59
Sandeep K. Dasari
12 Jun, 2023, 06:59
Sandeep K. Dasari
12 Jun, 2023, 07:00

You just need to create a controller for register and login route and write the appwrite logic to perform CRUD operations on USER, there are may features such as Verifying the emmail, Password Recovery in Account module of Appwrite.

varundeva
12 Jun, 2023, 07:04

Yes I'll go through this

Previously i got for Registration logic

Login method was not found in Server sdk That was in client sdk

varundeva
12 Jun, 2023, 07:10

For create user we send email and password

Similar method is not there to login i guess

varundeva
12 Jun, 2023, 08:58

Yes bht createSession method is in another sdk right?

Sandeep K. Dasari
12 Jun, 2023, 08:58

Aren't you using Account ?

Sandeep K. Dasari
12 Jun, 2023, 08:59

Are you using Users?

Sandeep K. Dasari
12 Jun, 2023, 09:00

Create an account using Users and login the user using Account. It will be fine

Sandeep K. Dasari
12 Jun, 2023, 09:00

User server sdk in account also.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more