Back

[SOLVED] How to Login a User with node-appwrite?

  • 0
  • Accounts
Marius B.
29 Feb, 2024, 19:04

Hello,

I am using the code that was generated by the AI in the Appwrite Dashboard. Sadly, the mentioned mathods are not available in the sdk.

TypeScript
import sdk from 'node-appwrite';

// Init SDK
const client = new sdk.Client();

const account = new sdk.Account(client);

client
    .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
    .setProject('<PROJECT_ID>') // Your project ID
    .setKey('<YOUR_SECRET_KEY>') // Your secret API key
;

const promise = account.createSession('email@example.com', 'password');

promise.then(function (response) {
    console.log(response); // Success
}, function (error) {
    console.log(error); // Failure
});
TL;DR
Developers were having trouble with server-side authentication using node-appwrite. They realized that the available methods differed depending on the selected version (1.4.x vs. cloud). The issue was resolved by discovering that the code snippet they were using was only valid for 1.5, which had updated documentation previewing upcoming changes. The recommendation was to wait for the 1.5 release or to struggle with server-side authentication in the current version.
Kenny
29 Feb, 2024, 19:12

A lot of this server side auth is avaliable in the 1.5 release which, I believe, will be released relatively soon. Otherwise I think you're going to struggle with server side auth.

Kenny
29 Feb, 2024, 19:13

The code above is valid with 1.5, the docs are updated to give a sneakpeak of sorts for whats to come.

Marius B.
29 Feb, 2024, 19:15

I was searching in the normal docs and was wondering why all the methods are not available. Thank you for letting me know!

Marius B.
29 Feb, 2024, 19:16

[SOLVED] How to Login a User with node-appwrite?

Kenny
29 Feb, 2024, 19:16

When looking make sure you have cloud or 1.4.x selected in the dropdown.

Marius B.
29 Feb, 2024, 19:20

It is not possible to use the Client Side SDK for Server Side Auth, is it?

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