SDK Dart v2.x

createRestrictedUser #

Creates a new user in Kuzzle, with a preset list of security profiles.

The list of security profiles attributed to restricted users is fixed, and must be configured in the Kuzzle configuration file.

This method allows users with limited rights to create other accounts, but blocks them from creating accounts with unwanted privileges (e.g. an anonymous user creating his own account).

Copied to clipboard!
Future<KuzzleUser> createRestrictedUser(Map<String, dynamic> body, String uid,
      {bool waitForRefresh})

Property Type Description
Map<String, dynamic>
User content & credentials
User kuid. If not provided, a random kuid is automatically generated

If set to true, Kuzzle will not respond until the user is indexed

body #

The body property must contain two objects:

  • content: User additional information. Can be left empty.
  • credentials: Describe how the new user can be authenticated. This object must contain one or more properties, named after the target authentication strategy to use. Each one of these properties are objects containing the credentials information, corresponding to that authentication strategy.


Copied to clipboard!
  'content': {
    'firstName': 'John',
    'lastName': 'Doe'
  'credentials': {
    'local': {
      'username': 'jdoe',
      'password': 'password'

Resolves #

A User object containing information about the newly created user.

Usage #

Copied to clipboard!
final result = await{
  'content': {
    'fullName': 'John Doe'
  'credentials': {
    'local': {
      'username': 'jdoe',
      'password': 'foobar'
}, 'jdoe');
User {
  _id: 'jdoe',
    { profileIds: [ 'default' ],
      fullName: 'John Doe',
        { author: '-1',
          createdAt: 1561379086534,
          udpatedAt: null,
          updater: null } } }