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.
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.
await authn.client.password.change(
"ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
"hunter2",
"My2n+Password"
);
Create User
create(request: CreateRequest): Promise<PangeaResponse<CreateResult>>Create a user.
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.
await authn.user.delete({
id: "pui_xpkhwpnz2cmegsws737xbsqnmnuwtbm5",
});
List Users
list(request: ListRequest): Promise<PangeaResponse<ListResult>>Look up users by scopes.
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.
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.
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.
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.
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.
const response = await authn.user.profile.update(
{
email: "joe.user@email.com",
profile: {
phone: "18085550173",
},
}
);
Namespace User
UserEnum IDProvider
IDProviderFACEBOOK
= "facebook"
GITHUB
= "github"
GOOGLE
= "google"
MICROSOFT_ONLINE
= "microsoftonline"
PASSWORD
= "password"