directus-dart icon indicating copy to clipboard operation
directus-dart copied to clipboard

How do you Sign up a new user from the SDK

Open NickoftheSouth opened this issue 1 year ago • 1 comments

I've tried code like this:

      DirectusUser user = DirectusUser(
         email: email,
         password: password,
         firstName: firstName,
         lastName: lastName)

      final DirectusResponse<DirectusUser> response = await _sdk!.users.createOne(user);

This works but you do need to make creating users public.

But I can't seem to work out how to add a user with additional fields.

I've tried swapping out DirectusUser with my custom user class (which extends DirectusUser). this creates the user but none of my additional fields are set on the new user.

What am I missing here?

Testing in the Andriod simulator under Windows Library version: directus: ^0.11.0

NickoftheSouth avatar May 12 '23 03:05 NickoftheSouth

This package is only providing features that API provides, and they are not currently providing register method see available methods.

As for custom fields, there is already an open issue #56. It's not as easy as JS SDK since Dart is not dynamically typed like JS/TS.

I'm open for proposals on how to implement custom fields in a clean way

apstanisic avatar May 15 '23 19:05 apstanisic