module Auth0::Api::V1::Users
Public Instance Methods
{auth0.com/docs/api#!#post–api-users–user_id–change_password_ticket}
# File lib/auth0/api/v1/users.rb, line 75 def change_password_ticket(user_id, new_password, result_url=nil) request_params = { "newPassword" => new_password, "resultUrl" => result_url } path = "/api/users/#{user_id}/change_password_ticket" post(path, request_params) end
{auth0.com/docs/api#!#get–api-clients–client-id–users}
# File lib/auth0/api/v1/users.rb, line 55 def client_users(client_id=@client_id) path = "/api/clients/#{client_id}/users" get(path) end
{auth0.com/docs/api#!#get–api-connections–connection–users} {auth0.com/docs/api#!#get–api-connections–connection–users-search–criteria-}
# File lib/auth0/api/v1/users.rb, line 34 def connection_users(connection_name, search=nil) path = "/api/connections/#{connection_name}/users" path += "?search=#{search.to_s}" unless search.to_s.empty? get(path) end
{auth0.com/docs/api#!#post–api-users–user_id–publickey}
# File lib/auth0/api/v1/users.rb, line 89 def create_public_key(user_id, device, public_key) path = "/api/users/#{user_id}/public_key" request_params = { device: device, public_key: public_key } post(path, request_params) end
{auth0.com/docs/api#!#post–api-users}
# File lib/auth0/api/v1/users.rb, line 61 def create_user(email, password, connection_name, request_params={}) options = { email: email, password: password, connection: connection_name } request_params.merge!(options) path = "/api/users" post(path, request_params) end
{auth0.com/docs/api#!#delete–api-users–user_id-}
# File lib/auth0/api/v1/users.rb, line 143 def delete_user(user_id) raise Auth0::UserIdIsBlank, "if you want to remove all users user delete_users method" if user_id.to_s.empty? path = "/api/users/#{user_id}" delete(path) end
{auth0.com/docs/api#!#delete–api-users}
This will remove all your users
# File lib/auth0/api/v1/users.rb, line 137 def delete_users path = "/api/users/" delete(path) end
{auth0.com/docs/api#!#get–api-enterpriseconnections-users-search–criteria-}
# File lib/auth0/api/v1/users.rb, line 43 def enterpriseconnections_users(search_criteria=nil, per_page=500) path = "/api/enterpriseconnections/users?search=#{search_criteria.to_s}&per_page=#{per_page.to_i.to_s}" get(path) end
{auth0.com/docs/api#!#patch–api-users–user_id–metadata}
# File lib/auth0/api/v1/users.rb, line 129 def patch_user_metadata(user_id, metadata={}) path = "/api/users/#{user_id}/metadata" patch(path, metadata) end
{auth0.com/docs/api#!#delete–api-users–user_id–publickey-device–device-}
# File lib/auth0/api/v1/users.rb, line 156 def revoke_user_device_public_key(user_id, device) path = "/api/users/#{user_id}/publickey?device=#{device}" delete(path) end
{auth0.com/docs/api#!#delete–api-users–user_id–refresh_tokens–refresh_token-}
# File lib/auth0/api/v1/users.rb, line 150 def revoke_user_refresh_token(user_id, refresh_token) path = "/api/users/#{user_id}/refresh_tokens/#{refresh_token}" delete(path) end
{auth0.com/docs/api#!#post–api-users–user_id–send_verification_email}
# File lib/auth0/api/v1/users.rb, line 69 def send_verification_email(user_id) path = "/api/users/#{user_id}/send_verification_email" post(path) end
{auth0.com/docs/api#!#put–api-users–user_id–email}
# File lib/auth0/api/v1/users.rb, line 96 def update_user_email(user_id, email, verify=true) path = "/api/users/#{user_id}/email" request_params = { email: email, verify: verify } put(path, request_params) end
{auth0.com/docs/api#!#put–api-users–user_id–metadata} This will overwrite user’s metadata, be really carefull, preffer using patch instead
# File lib/auth0/api/v1/users.rb, line 104 def update_user_metadata(user_id, metadata={}) path = "/api/users/#{user_id}/metadata" put(path, metadata) end
{auth0.com/docs/api#!#put–api-users–user_id–password}
# File lib/auth0/api/v1/users.rb, line 110 def update_user_password(user_id, password, verify=true) path = "/api/users/#{user_id}/password" request_params = { password: password, verify: verify } put(path, request_params) end
{auth0.com/docs/api#!#put–api-users–email–password}
# File lib/auth0/api/v1/users.rb, line 117 def update_user_password_using_email(email, password, connection_name, verify=true) request_params = { email: email, password: password, connection: connection_name, verify: verify } path = "/api/users/#{email}/password" put(path, request_params) end
{auth0.com/docs/api#!#get–api-users–user_id-}
# File lib/auth0/api/v1/users.rb, line 19 def user(user_id) path = "/api/users/#{user_id}" get(path) end
{auth0.com/docs/api#!#get–api-users–user_id–devices}
# File lib/auth0/api/v1/users.rb, line 27 def user_devices(user_id) path = "/api/users/#{user_id}/devices" get(path) end
{auth0.com/docs/api#!#get–api-users}
{auth0.com/docs/api#!#get–api-users-search–criteria-}
# File lib/auth0/api/v1/users.rb, line 9 def users(search=nil) path = "/api/users" path += "?search=#{search.to_s}" unless search.to_s.empty? get(path) end
{auth0.com/docs/api#!#post–api-users–user_id–verification_ticket}
# File lib/auth0/api/v1/users.rb, line 82 def verification_ticket(user_id, result_url=nil) request_params = {"resultUrl" => result_url} path = "/api/users/#{user_id}/verification_ticket" post(path, request_params) end