Back

How can to retrieve UID in Server side using email and password

  • 0
  • Self Hosted
  • Web
showmore
27 Mar, 2023, 07:59

Hey every one, I have some problem, I wanna respond UserId when the user login using email and password from Rest API and Create Email Session() only work in client server, how can I get UserId from Server side, Thanks

TL;DR
User is asking how to retrieve UID using email and password in server-side. They mention using REST API and creating a custom API endpoint. They also mention using .NET framework and Laravel. Another user suggests using the `account.get()` method to retrieve the unique ID. Solution: Use the `account.get()` method to get the UID after the user logs in.
safwan
27 Mar, 2023, 08:36

Once the user logs in, use account.get()

safwan
27 Mar, 2023, 08:36

It returns an Account object, which includes the unique ID.

safwan
27 Mar, 2023, 08:37
showmore
27 Mar, 2023, 09:12

how to login in server side, I am confussed

showmore
27 Mar, 2023, 09:18

in my Laravel I add Appwrite sdk via composer, but I can't find Create Email Session() method, its because it only valid for server side or ? can please help me

safwan
27 Mar, 2023, 09:27

can i ask why you want to respond with the userId from the server-side?

safwan
27 Mar, 2023, 09:27

when a user logs in, it returns a Session Object on the client which includes userId

showmore
27 Mar, 2023, 14:23

For client side there are 4 SDK uses, unfortunately my client uses .NET frame work, so I decide to use REST API, so I create email and password field in this net application and request Rest API to this end point "/v1/account/sessions/email", BUT error "guest user, Authorization error", how can I create user session in this case ? I try to create custom API endpoint in server side using api_key, but in server side there is no createEmailSession() function, that why I ask this question.

Drake
27 Mar, 2023, 16:58

Will you have any JavaScript?

showmore
27 Mar, 2023, 17:30

no, I only use https request

showmore
27 Mar, 2023, 17:31

server side php, client side .NET

Drake
27 Mar, 2023, 17:45

client side .net...interesting...

So since there's no SDK (and even if there were, the SDK currently in progress is for server-side use), you'll need to make the API calls and manage the session manually. This should be helpful: https://appwrite.io/docs/rest#client-auth. Then, after you have a session, you can call https://appwrite.io/docs/client/account?sdk=rest-default#accountGet

Drake
27 Mar, 2023, 17:46

The example has X-Appwrite-JWT, but you might want to use the cookie if you can

showmore
27 Mar, 2023, 18:09

Thanks it help lot

showmore
29 Mar, 2023, 06:57

can you tell me the progress .net sdk for server side, when it will release, thanks

Drake
29 Mar, 2023, 17:30

I'm not sure about the timeline for a release, but you can follow along with https://github.com/appwrite/sdk-generator/pull/320 to stay updated

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