why deepstreamHub? compare us getting started faq
use cases
products
developers
company
blog contact

This file is used in conjunction with file-based authentication. It is structured as a map of usernames and their associated passwords and optional auth data.

The userfile can be written in YAML or JSON.

# Username as key
johndoe:
  # Password as hash if auth.options.has is configured or in cleartext
  password: uY2zMQZXcFuWKeX/6eY43w==9wSp046KHAQfbvKcKgvwNA==
  # Optional auth data that will be passed to permissioning as user.data
  clientData:
    favoriteDessert: brownies
  serverData:
    role: admin

samjones:
  password: 7KZrUQcnFUDNOQtqtKqhCA==ElDieSHdI2vtiws41JF/HQ==
  clientData:
    favoriteDessert: shortbread
  serverData:
    role: user

or in JSON

{
  "johndoe": {
    "password": "uY2zMQZXcFuWKeX/6eY43w==9wSp046KHAQfbvKcKgvwNA==",
    "clientData": { "favoriteColor": "yellow" },
    "serverData": { "role": "admin" }
  },
  "samjones": {
    "password": "7KZrUQcnFUDNOQtqtKqhCA==ElDieSHdI2vtiws41JF/HQ==",
    "clientData": { "favoriteColor": "violet" },
    "serverData": { "role": "user" }
  }
}


Hint

  • - You can create hashes from passwords with the currently specified settings using deepstream's command line interface
deepstream hash <password>

e.g.

deepstream hash console output

data

Optional authentication data, e.g. role: admin or canCreatePosts: true. This data will be available in your permission rules as user.data. Data stored within clientData will also be forwarded to the client as part of the login process.

{
  "samjones": {
    "password": "7KZrUQcnFUDNOQtqtKqhCA==ElDieSHdI2vtiws41JF/HQ==",
    "clientData": { "user-alias": "sammy" },
    "serverData": { "role": "user" }
  }
}