Documentation
¶
Index ¶
- type Client
- func (c *Client) Create(ctx context.Context, request *management.CreateUserRequestContent, ...) (*management.CreateUserResponseContent, error)
- func (c *Client) Delete(ctx context.Context, id string, opts ...option.RequestOption) error
- func (c *Client) Get(ctx context.Context, id string, request *management.GetUserRequestParameters, ...) (*management.GetUserResponseContent, error)
- func (c *Client) List(ctx context.Context, request *management.ListUsersRequestParameters, ...) (...)
- func (c *Client) ListUsersByEmail(ctx context.Context, request *management.ListUsersByEmailRequestParameters, ...) ([]*management.UserResponseSchema, error)
- func (c *Client) RegenerateRecoveryCode(ctx context.Context, id string, opts ...option.RequestOption) (*management.RegenerateUsersRecoveryCodeResponseContent, error)
- func (c *Client) RevokeAccess(ctx context.Context, id string, ...) error
- func (c *Client) Update(ctx context.Context, id string, request *management.UpdateUserRequestContent, ...) (*management.UpdateUserResponseContent, error)
- type RawClient
- func (r *RawClient) Create(ctx context.Context, request *management.CreateUserRequestContent, ...) (*core.Response[*management.CreateUserResponseContent], error)
- func (r *RawClient) Delete(ctx context.Context, id string, opts ...option.RequestOption) (*core.Response[any], error)
- func (r *RawClient) Get(ctx context.Context, id string, request *management.GetUserRequestParameters, ...) (*core.Response[*management.GetUserResponseContent], error)
- func (r *RawClient) ListUsersByEmail(ctx context.Context, request *management.ListUsersByEmailRequestParameters, ...) (*core.Response[[]*management.UserResponseSchema], error)
- func (r *RawClient) RegenerateRecoveryCode(ctx context.Context, id string, opts ...option.RequestOption) (*core.Response[*management.RegenerateUsersRecoveryCodeResponseContent], error)
- func (r *RawClient) RevokeAccess(ctx context.Context, id string, ...) (*core.Response[any], error)
- func (r *RawClient) Update(ctx context.Context, id string, request *management.UpdateUserRequestContent, ...) (*core.Response[*management.UpdateUserResponseContent], error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
WithRawResponse *RawClient
AuthenticationMethods *authenticationmethods.Client
Authenticators *authenticators.Client
ConnectedAccounts *connectedaccounts.Client
EffectivePermissions *client.Client
EffectiveRoles *effectiverolesclient.Client
Enrollments *enrollments.Client
Groups *groups.Client
Identities *identities.Client
Logs *logs.Client
Multifactor *multifactor.Client
Organizations *organizations.Client
Permissions *permissions.Client
RiskAssessments *riskassessments.Client
Roles *roles.Client
RefreshToken *refreshtoken.Client
Sessions *sessions.Client
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(options *core.RequestOptions) *Client
func (*Client) Create ¶
func (c *Client) Create( ctx context.Context, request *management.CreateUserRequestContent, opts ...option.RequestOption, ) (*management.CreateUserResponseContent, error)
Create a new user for a given [database](https://auth0.com/docs/connections/database) or [passwordless](https://auth0.com/docs/connections/passwordless) connection.
Note: `connection` is required but other parameters such as `email` and `password` are dependent upon the type of connection.
func (*Client) Delete ¶
Delete a user by user ID. This action cannot be undone. For Auth0 Dashboard instructions, see [Delete Users](https://auth0.com/docs/manage-users/user-accounts/delete-users).
func (*Client) Get ¶
func (c *Client) Get( ctx context.Context, id string, request *management.GetUserRequestParameters, opts ...option.RequestOption, ) (*management.GetUserResponseContent, error)
Retrieve user details. A list of fields to include or exclude may also be specified. For more information, see [Retrieve Users with the Get Users Endpoint](https://auth0.com/docs/manage-users/user-search/retrieve-users-with-get-users-endpoint).
func (*Client) List ¶
func (c *Client) List( ctx context.Context, request *management.ListUsersRequestParameters, opts ...option.RequestOption, ) (*core.Page[*int, *management.UserResponseSchema, *management.ListUsersOffsetPaginatedResponseContent], error)
Retrieve details of users. It is possible to:
- Specify a search criteria for users - Sort the users to be returned - Select the fields to be returned - Specify the number of users to retrieve per page and the page index
The `q` query parameter can be used to get users that match the specified criteria [using query string syntax.](https://auth0.com/docs/users/search/v3/query-syntax)
[Learn more about searching for users.](https://auth0.com/docs/users/search/v3)
Read about [best practices](https://auth0.com/docs/users/search/best-practices) when working with the API endpoints for retrieving users.
Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the [export job](https://auth0.com/docs/api/management/v2#!/Jobs/post_users_exports), or the [User Import / Export](https://auth0.com/docs/extensions/user-import-export) extension.
func (*Client) ListUsersByEmail ¶
func (c *Client) ListUsersByEmail( ctx context.Context, request *management.ListUsersByEmailRequestParameters, opts ...option.RequestOption, ) ([]*management.UserResponseSchema, error)
Find users by email. If Auth0 is the identity provider (idP), the email address associated with a user is saved in lower case, regardless of how you initially provided it.
For example, if you register a user as JohnSmith@example.com, Auth0 saves the user's email as johnsmith@example.com.
Therefore, when using this endpoint, make sure that you are searching for users via email addresses using the correct case.
func (*Client) RegenerateRecoveryCode ¶
func (c *Client) RegenerateRecoveryCode( ctx context.Context, id string, opts ...option.RequestOption, ) (*management.RegenerateUsersRecoveryCodeResponseContent, error)
Remove an existing multi-factor authentication (MFA) [recovery code](https://auth0.com/docs/secure/multi-factor-authentication/reset-user-mfa) and generate a new one. If a user cannot access the original device or account used for MFA enrollment, they can use a recovery code to authenticate.
func (*Client) RevokeAccess ¶
func (c *Client) RevokeAccess( ctx context.Context, id string, request *management.RevokeUserAccessRequestContent, opts ...option.RequestOption, ) error
Revokes selected resources related to a user (sessions, refresh tokens, ...).
func (*Client) Update ¶
func (c *Client) Update( ctx context.Context, id string, request *management.UpdateUserRequestContent, opts ...option.RequestOption, ) (*management.UpdateUserResponseContent, error)
Update a user.
These are the attributes that can be updated at the root level:
- app_metadata - blocked - email - email_verified - family_name - given_name - name - nickname - password - phone_number - phone_verified - picture - username - user_metadata - verify_email
Some considerations:
- The properties of the new object will replace the old ones. - The metadata fields are an exception to this rule (`user_metadata` and `app_metadata`). These properties are merged instead of being replaced but be careful, the merge only occurs on the first level. - If you are updating `email`, `email_verified`, `phone_number`, `phone_verified`, `username` or `password` of a secondary identity, you need to specify the `connection` property too. - If you are updating `email` or `phone_number` you can specify, optionally, the `client_id` property. - Updating `email_verified` is not supported for enterprise and passwordless sms connections. - Updating the `blocked` to `false` does not affect the user's blocked state from an excessive amount of incorrectly provided credentials. Use the "Unblock a user" endpoint from the "User Blocks" API to change the user's state. - Supported attributes can be unset by supplying `null` as the value.
**Updating a field (non-metadata property)**
To mark the email address of a user as verified, the body to send should be:
```json { "email_verified": true } ```
**Updating a user metadata root property**
Let's assume that our test user has the following `user_metadata`:
```json { "user_metadata" : { "profileCode": 1479 } } ```
To add the field `addresses` the body to send should be:
```json { "user_metadata" : { "addresses": {"work_address": "100 Industrial Way"} }} ```
The modified object ends up with the following `user_metadata` property:
```json
{
"user_metadata": {
"profileCode": 1479,
"addresses": { "work_address": "100 Industrial Way" }
}
}
```
**Updating an inner user metadata property**
If there's existing user metadata to which we want to add `"home_address": "742 Evergreen Terrace"` (using the `addresses` property) we should send the whole `addresses` object. Since this is a first-level object, the object will be merged in, but its own properties will not be. The body to send should be:
```json
{
"user_metadata": {
"addresses": {
"work_address": "100 Industrial Way",
"home_address": "742 Evergreen Terrace"
}
}
}
```
The modified object ends up with the following `user_metadata` property:
```json
{
"user_metadata": {
"profileCode": 1479,
"addresses": {
"work_address": "100 Industrial Way",
"home_address": "742 Evergreen Terrace"
}
}
}
```
type RawClient ¶
type RawClient struct {
// contains filtered or unexported fields
}
func NewRawClient ¶
func NewRawClient(options *core.RequestOptions) *RawClient
func (*RawClient) Create ¶
func (r *RawClient) Create( ctx context.Context, request *management.CreateUserRequestContent, opts ...option.RequestOption, ) (*core.Response[*management.CreateUserResponseContent], error)
func (*RawClient) Get ¶
func (r *RawClient) Get( ctx context.Context, id string, request *management.GetUserRequestParameters, opts ...option.RequestOption, ) (*core.Response[*management.GetUserResponseContent], error)
func (*RawClient) ListUsersByEmail ¶
func (r *RawClient) ListUsersByEmail( ctx context.Context, request *management.ListUsersByEmailRequestParameters, opts ...option.RequestOption, ) (*core.Response[[]*management.UserResponseSchema], error)
func (*RawClient) RegenerateRecoveryCode ¶
func (r *RawClient) RegenerateRecoveryCode( ctx context.Context, id string, opts ...option.RequestOption, ) (*core.Response[*management.RegenerateUsersRecoveryCodeResponseContent], error)
func (*RawClient) RevokeAccess ¶
func (r *RawClient) RevokeAccess( ctx context.Context, id string, request *management.RevokeUserAccessRequestContent, opts ...option.RequestOption, ) (*core.Response[any], error)
func (*RawClient) Update ¶
func (r *RawClient) Update( ctx context.Context, id string, request *management.UpdateUserRequestContent, opts ...option.RequestOption, ) (*core.Response[*management.UpdateUserResponseContent], error)