As per the document and example code give here https://appwrite.io/docs/client/account?sdk=web-default#accountCreateEmailSession I was expecting a promise to be returned, it was returning a promise when I tried via client side request, but when I shifted the code to the server side execution, I am not getting a response as a promise indeed for a valid a user the response if a session object and for invalid user the SDK throws an error.
Seems a little strange to me how come the response type changes upon where it is implemented?
Problem: Due to this I am unable to show an exactly error like wmail is invalid or password is incorrect to the user, indeed what appwrite does is throws and exception if the username or password is invvalid
Can any one help with this ?
Can you share the code?
here it is, its little messy please bare with it 😛
If you're using the keyword await
then you will get the results and the promise. so change from this
let promise = await account.createEmailSession(userName, passWord);
promise.then(function (response) {
To this,
let promise = account.createEmailSession(userName, passWord);
promise.then(function (response) {
and then you'll get back the promise.
Ohh got it
@Binyamin thanks a lot this was a silly one my bad, I was not having the proper understanding of how promise works .
👍 Sure thing, seems just fine
Recommended threads
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Different appwrite IDs are getting expos...
File_URL_FORMAT= https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] I'm trying to access files in my web app...
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...