Back

can we use the auth system for the express backend?

  • 0
  • Self Hosted
varundeva
3 May, 2023, 05:35

Hello

I've checked the node-appwrite package I got to know the user registration flow

There is no option for user login in node-appwrite

My question is can we use appwrite to replace the auth system of normal MERN Stack application?

Currently I'm doing login and signup functionality in express . When the user login creates the jwt token and passes to the frontend. Every time frontend makes a api call validating the jwt token passed in header

Can we replace the sign-up route with an appwrite ? Basically i did this But in the login route i get an email and password in my body. I need to call the login method of the appwrite and pass the jwt to the frontend when the login is a success Then each api call i need to verify the jwt.

Is that possible?

TL;DR
The user wants to know if they can use Appwrite to replace the authentication system of their Express backend. Unfortunately, Appwrite currently does not have a direct implementation of login with the server SDK. The user can implement the needed logic to save the session ID on the server side to handle login. They can also check the provided links for more details and upvote an issue on GitHub for this feature request. There is no solution provided in this support thread.
Binyamin
3 May, 2023, 12:48

In Appwrite it mostly works the opposite, what means that all the login logic must take place in the frontend. So you can do so by either by implanting the needed logic to save the session id in the server side.

You can see some details here: https://discord.com/channels/564160730845151244/1092520228858105856/1092523507553935360

And you can check this thread: https://discord.com/channels/564160730845151244/1087482990680084680/1087482990680084680

And, Maybe upvoting this issue. https://github.com/appwrite/appwrite/issues/3891

varundeva
4 May, 2023, 04:40

Yes Got it There is no direct way as of now. I hope the appwrite will give a feature which supports the complete server side

safwan
4 May, 2023, 06:25

Correct me if I'm wrong, but you want to perform User Signup and User Login in your express app right?

With Appwrite's server sdk, you can use the Users API (https://appwrite.io/docs/server/users) for the signup. As @Binyamin mentioned, appwrite currently has no direct implementation of login with the server sdk.

varundeva
4 May, 2023, 07:49

@safwan you saying that i can install 2 sdk in express itself and handle both login and signup?

safwan
4 May, 2023, 14:11

not necessarily

safwan
4 May, 2023, 14:12

you're using node-appwrite package right?

safwan
4 May, 2023, 14:12

just initialize the users api as well

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