Skip to main content

AuthN | Node SDK | User Endpoints

User Endpoints

Get User (client token)

userinfo(code: string): Promise<PangeaResponse<UserinfoResult>>

Retrieve the logged in user's token and information.

required parameters

string

Login code returned by the login callback

Response Object

Promise<PangeaResponse<UserinfoResult>>
const response = await authn.client.userinfo(
  "pmc_d6chl6qulpn3it34oerwm3cqwsjd6dxw"
);

Change a user's password

change(token: string, oldPassword: string, newPassword: string): Promise<PangeaResponse<{}>>

Change a user's password given the current password.

required parameters

string

An user token value

string

The old password

string

The new password

Response Object

Promise<PangeaResponse<{}>>
await authn.client.password.change(
  "ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
  "hunter2",
  "My2n+Password"
);

Create User

create(request: CreateRequest): Promise<PangeaResponse<CreateResult>>

Create a user.

required parameters

CreateRequest

Response Object

Promise<PangeaResponse<CreateResult>>
const response = await authn.user.create({
  email: "joe.user@email.com",
  profile: {
    first_name: "Joe",
    last_name: "User",
  },
});

Delete User

delete(request: EmailRequest | IDRequest | UsernameRequest): Promise<PangeaResponse<{}>>

Delete a user.

required parameters

EmailRequest | IDRequest | UsernameRequest

Supported options:

  • email (string): An email address.
  • id (string): The identity of a user or a service.
  • username (string): A username.

Response Object

Promise<PangeaResponse<{}>>
await authn.user.delete({
  id: "pui_xpkhwpnz2cmegsws737xbsqnmnuwtbm5",
});

List Users

list(request: ListRequest): Promise<PangeaResponse<ListResult>>

Look up users by scopes.

required parameters

ListRequest

Supported options:

  • filter (object)
  • last (string): Reflected value from a previous response to obtain the next page of results.
  • order (AuthN.ItemOrder): Order results asc(ending) or desc(ending).
  • order_by (AuthN.User.ListOrderBy): Which field to order results by.
  • size (number): Maximum results to include in the response.

Response Object

Promise<PangeaResponse<ListResult>>
const response = await authn.user.list(
  {
    order: AuthN.ItemOrder.ASC,
    order_by: AuthN.User.ListOrderBy.ID,
    size: 20,
  }
);

Update user's settings

update(request: EmailRequest | IDRequest | UsernameRequest): Promise<PangeaResponse<UpdateResult>>

Update user's settings.

required parameters

EmailRequest | IDRequest | UsernameRequest

Supported request parameters:

  • email (string): An email address.
  • id (string): The identity of a user or a service.
  • username (string): A username.
  • disabled (boolean): Disabling a user account will prevent them from logging in.
  • unlock (boolean): Unlock a user account if it has been locked out due to failed authentication attempts.

Response Object

Promise<PangeaResponse<UpdateResult>>
const response = await authn.user.update(
  {
   email: "joe.user@email.com",
   disabled: false,
  }
);

Delete user authenticator

delete(request: IDRequest | EmailRequest | UsernameRequest): Promise<PangeaResponse<{}>>

Delete a user's authenticator.

required parameters

IDRequest | EmailRequest | UsernameRequest

Response Object

Promise<PangeaResponse<{}>>
await authn.authenticators.delete({
  id: "pui_xpkhwpnz2cmegsws737xbsqnmnuwtbm5",
  authenticator_id: "pau_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
});

Get user authenticators

list(request: ListRequest): Promise<PangeaResponse<ListResult>>

Get user's authenticators by identity or email.

required parameters

ListRequest

Response Object

Promise<PangeaResponse<ListResult>>
const response = await authn.user.authenticators.list({
  id: "pui_xpkhwpnz2cmegsws737xbsqnmnuwtbm5",
});

Get user

getProfile(data: EmailRequest | IDRequest | UsernameRequest): Promise<PangeaResponse<GetResult>>

Get user's information by identity or email.

required parameters

EmailRequest | IDRequest | UsernameRequest

Must include one of email, id, or username:

  • email (string): An email address.
  • id (string): The identity of a user or a service.
  • username (string): A username.

Response Object

Promise<PangeaResponse<GetResult>>
const response = await authn.user.profile.getProfile(
  {
    email: "joe.user@email.com",
  }
);

Update user

update(data: EmailRequest | IDRequest | UsernameRequest): Promise<PangeaResponse<UpdateResult>>

Update user's information by identity or email.

required parameters

EmailRequest | IDRequest | UsernameRequest

Must include profile and one of email, id, or username`:

  • email (string): An email address.
  • id (string): The identity of a user or a service.
  • username (string): A username.
  • profile (object): Updates to a user profile.

Response Object

Promise<PangeaResponse<UpdateResult>>
const response = await authn.user.profile.update(
  {
    email: "joe.user@email.com",
    profile: {
      phone: "18085550173",
    },
  }
);

Namespace User

User

Enum IDProvider

IDProvider

FACEBOOK = "facebook"

GITHUB = "github"

GOOGLE = "google"

MICROSOFT_ONLINE = "microsoftonline"

PASSWORD = "password"