AuthN | Go SDK | User Endpoints
User Endpoints
Get User (client token)
func (a *Client) Userinfo(ctx context.Context, input ClientUserinfoRequest) (*pangea.PangeaResponse[ClientUserinfoResult], error)Retrieve the logged in user's token and information.
input := authn.ClientUserinfoRequest{
Code: "pmc_d6chl6qulpn3it34oerwm3cqwsjd6dxw",
}
esp, err := authncli.Client.Userinfo(ctx, input)
Change a user's password
func (a *ClientPassword) Change(ctx context.Context, input ClientPasswordChangeRequest) (*pangea.PangeaResponse[ClientPasswordChangeResult], error)Change a user's password given the current password.
input := authn.ClientPasswordChangeRequest{
Token: "ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
OldPassword: "hunter2",
NewPassword: "My2n+Password",
}
resp, err := authncli.Client.Password.Change(ctx, input)
Create User
func (a *User) Create(ctx context.Context, input UserCreateRequest) (*pangea.PangeaResponse[UserCreateResult], error)Create a user. Also allows creating the user's credentials.
profile := &authn.ProfileData{
"first_name": "Joe",
"last_name": "User",
}
input := authn.UserCreateRequest{
Email: "joe.user@email.com",
Profile: profile,
}
resp, err := authncli.User.Create(ctx, input)
Delete User
func (a *User) Delete(ctx context.Context, input UserDeleteRequest) (*pangea.PangeaResponse[UserDeleteResult], error)Delete a user.
input := UserDeleteRequest{
Email: "joe.user@email.com",
}
authncli.User.Delete(ctx, input)
List Users
func (a *User) List(ctx context.Context, input UserListRequest) (*pangea.PangeaResponse[UserListResult], error)Look up users by scopes.
input := authn.UserListRequest{}
resp, err := authncli.User.List(ctx, input)
Update user's settings
func (a *User) Update(ctx context.Context, input UserUpdateRequest) (*pangea.PangeaResponse[UserUpdateResult], error)Update user's settings.
input := authn.UserUpdateRequest{
Email: pangea.String("joe.user@email.com"),
RequireMFA: pangea.Bool(true),
}
resp, err := authncli.User.Update(ctx, input)
Delete user authenticator
func (a *UserAuthenticators) Delete(ctx context.Context, input UserAuthenticatorsDeleteRequest) (*pangea.PangeaResponse[UserAuthenticatorsDeleteResult], error)Delete a user's authenticator.
input := authn.UserAuthenticatorsDeleteRequest{
ID: pangea.String("pui_zgp532cx6opljeavvllmbi3iwmq72f7f"),
AuthenticatorID: "pau_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
}
resp, err := authncli.User.Authenticators.Delete(ctx, input)
Get user authenticators
func (a *UserAuthenticators) List(ctx context.Context, input UserAuthenticatorsListRequest) (*pangea.PangeaResponse[UserAuthenticatorsListResult], error)Get user's authenticators by identity or email.
input := authn.UserAuthenticatorsListRequest{
ID: pangea.String("pui_xpkhwpnz2cmegsws737xbsqnmnuwtvm5"),
}
resp, err := authncli.User.Authenticators.List(ctx, input)
Get user
func (a *UserProfile) Get(ctx context.Context, input UserProfileGetRequest) (*pangea.PangeaResponse[UserProfileGetResult], error)Get user's information by identity or email.
input := authn.UserProfileGetRequest{
Email: pangea.String("joe.user@email.com"),
}
resp, err := authncli.User.Profile.Get(ctx, input)
Update user
func (a *UserProfile) Update(ctx context.Context, input UserProfileUpdateRequest) (*pangea.PangeaResponse[UserProfileUpdateResult], error)Update user's information by identity or email.
input := authn.UserProfileUpdateRequest{
Email: pangea.String("joe.user@email.com"),
Profile: authn.ProfileData{
"country": "Argentina",
},
}
resp, err := authncli.User.Profile.Update(ctx, input)
Type ClientPasswordChangeRequest
type ClientPasswordChangeRequest structtype ClientPasswordChangeRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
Token string `json:"token"`
OldPassword string `json:"old_password"`
NewPassword string `json:"new_password"`
}
Type ClientUserinfoRequest
type ClientUserinfoRequest structtype ClientUserinfoRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
Code string `json:"code"`
}
Type UserAuthenticatorsDeleteRequest
type UserAuthenticatorsDeleteRequest structtype UserAuthenticatorsDeleteRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
ID *string `json:"id,omitempty"` // The identity of a user or a service.
Email *string `json:"email,omitempty"` // An email address.
Username *string `json:"username,omitempty"` // A username.
AuthenticatorID string `json:"authenticator_id"` // An ID for an authenticator.
}
Type UserAuthenticatorsListRequest
type UserAuthenticatorsListRequest structtype UserAuthenticatorsListRequest struct {
pangea.BaseRequest
ID *string `json:"id,omitempty"` // The identity of a user or a service.
Email *string `json:"email,omitempty"` // An email address.
Username *string `json:"username,omitempty"` // A username.
}
Type UserCreateRequest
type UserCreateRequest structtype UserCreateRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
Email string `json:"email"` // An email address.
Profile ProfileData `json:"profile"` // A user profile as a collection of string properties.
Username string `json:"username,omitempty"` // A username.
}
Type UserDeleteRequest
type UserDeleteRequest structtype UserDeleteRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
Email string `json:"email,omitempty"` // An email address.
ID string `json:"id,omitempty"` // The identity of a user or a service.
Username string `json:"username,omitempty"` // A username.
}
Type UserListRequest
type UserListRequest structtype UserListRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
// Should user FilterUserList object here
Filter pangea.Filter `json:"filter,omitempty"`
Last string `json:"last,omitempty"`
Order ItemOrder `json:"order,omitempty"`
OrderBy UserListOrderBy `json:"order_by,omitempty"`
Size int `json:"size,omitempty"`
}
Type UserProfileGetRequest
type UserProfileGetRequest structtype UserProfileGetRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
ID *string `json:"id,omitempty"` // The identity of a user or a service.
Email *string `json:"email,omitempty"` // An email address.
Username *string `json:"username,omitempty"` // A username.
}
Type UserProfileUpdateRequest
type UserProfileUpdateRequest structtype UserProfileUpdateRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
Profile ProfileData `json:"profile"` // Updates to a user profile.
ID *string `json:"id,omitempty"` // The identity of a user or a service.
Email *string `json:"email,omitempty"` // An email address.
Username *string `json:"username,omitempty"` // A username.
}
Type UserUpdateRequest
type UserUpdateRequest structtype UserUpdateRequest struct {
// Base request has ConfigID for multi-config projects
pangea.BaseRequest
ID *string `json:"id,omitempty"` // The identity of a user or a service.
Email *string `json:"email,omitempty"` // An email address.
Username *string `json:"username,omitempty"` // A username.
Disabled *bool `json:"disabled,omitempty"` // New disabled value. Disabling a user account will prevent them from logging in.
Unlock *bool `json:"unlock,omitempty"` // Unlock a user account if it has been locked out due to failed authentication attempts.
}