Skip to main content

Users - Built-in Entity

Nile includes a built-in user authentication system. It handles user accounts, signup and user sessions.Each user instance exists in a specific Nile workspace and can belong to one or more organizations in this workspace.

Note that we currently support only email/password authentication for users. We are planning to add support for social logins, passwordless authentication and SSO integration in the near future.

Schema

The user entity has the following fields that can be set when users are created and modified by users or developers:

nametyperequiredsemantics
emailstringy
passwordhashed stringyNile stores user passwords as a salted hash
metadataJSon formatted objectnAdditional information about the user. For example: Full name, address, date of birth or favorite color.
org_membershipsJSON formatted objectnThis is metadata for the user in a specific organization. It includes the data in which the user joined the organization and additional information such as their role in the organization.

Those fields are in addition to the default fields that exist for all Nile entities.

APIs

Nile's built-in user functionality includes signup, login and basic user management via REST APIs and Javascript SDK (Python SDK coming soon)

See the API Reference for full documentation of Nile's REST APIs and JS SDK. The documentation below shows snippets for a few common tasks.

Signup

    curl "https://prod.thenile.dev/workspaces/$NILE_WORKSPACE/users" -X POST -H 'Content-Type: application/json' -d '{"email":"norwood@demo.io", "password": "insecure"}'

Creates a user and an org for the user, named after the user's email (TODO: Give the org a better name).

Login

    curl "https://prod.thenile.dev/workspaces/$NILE_WORKSPACE/auth/login" -X POST -H 'Content-Type: application/json' -d '{"email":"norwood@demo.io", "password": "insecure"}'

Returns a JWT on successful login, meant to be used in authenticated API calls.

Change email and/or password

    curl "https://prod.thenile.dev/workspaces/$NILE_WORKSPACE/users/$USER_ID" -X PUT -H 'Authorization: Bearer eyJhbGci...' -H 'Content-Type: application/json' -d '{"email":"gwen@demo.io", "password":"new_password"}'

List all users in a workspace

    curl "https://prod.thenile.dev/workspaces/$NILE_WORKSPACE/users" -H 'Authorization: Bearer eyJhbGci...'

Delete user

    curl "https://prod.thenile.dev/workspaces/$NILE_WORKSPACE/users/$USER_ID" -v -X DELETE -H 'Authorization: Bearer eyJhbGciOiJI...'

Events

TBD

Metrics

TBD