witsWITS
Docs

Authenticating Users


Register a user through backend

For letting users to join and interract with wits actions, you should register them inside wits database. This is only an identifier for the user, so that it can store the users activity and then be retrived later on.

const serverAPI = createDashboardAPI({
  appId: "",
  privateKey: "",
})

const res = await serverAPI.POST("/v2/dashboard/users/register/", {
  body: {
    username: "test-username",
  },
})

Login a user with username

Later on you can use that username or user.pk to login the user and get a token

serverAPI.POST("/v2/dashboard/users/login-with-user-id/", {
  body: {
    id: -1,
  },
})

// OR

serverAPI.POST("/v2/dashboard/users/login-with-username/", {
  body: {
    username: "",
  },
})

Get Users list

To get the list of users registered in wits with your organization you can use /users/list api

serverAPI.GET("/v2/dashboard/users/list/", {
  params: {
    query: {
      limit: 15,
      offset: 0,
    },
  },
})

Get a user by username or id

serverAPI.GET("/v2/dashboard/users/", {
  params: {
    query: {
      userid: -1,
      // OR username
      username: "",
    },
  },
})