Skip to main content

register()

Register a new user.

const { user, token, error } = await kontenbase.auth.register({
firstName: 'Ega',
lastName: 'Radiegtya',
email: '[email protected]',
password: 'password',
})

Response

NameTypeDescription
res.userobjectResponse for data user
res.tokenstringResponse for data token
res.statusnumberResponse for status code
res.statusTextstringResponse for status message
res.errorobjectResponse for error occurred
info

Using this method in browser will also save the returned token in localStorage.

note
  • First registered user will have "admin" role
  • token returned is a Bearer Token Authentication that can be set in the header