auth0 5.0.0 → 5.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +29 -8
  3. data/.github/CODEOWNERS +1 -1
  4. data/.github/ISSUE_TEMPLATE/config.yml +8 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.md +39 -0
  6. data/.github/ISSUE_TEMPLATE/report_a_bug.md +55 -0
  7. data/.gitignore +1 -0
  8. data/CHANGELOG.md +46 -0
  9. data/README.md +80 -1
  10. data/auth0.gemspec +4 -3
  11. data/lib/auth0/api/authentication_endpoints.rb +16 -6
  12. data/lib/auth0/api/v2.rb +8 -4
  13. data/lib/auth0/api/v2/branding.rb +66 -0
  14. data/lib/auth0/api/v2/connections.rb +3 -0
  15. data/lib/auth0/api/v2/jobs.rb +3 -1
  16. data/lib/auth0/api/v2/organizations.rb +335 -0
  17. data/lib/auth0/api/v2/tickets.rb +14 -2
  18. data/lib/auth0/api/v2/users.rb +13 -1
  19. data/lib/auth0/exception.rb +3 -1
  20. data/lib/auth0/mixins/httpproxy.rb +4 -1
  21. data/lib/auth0/mixins/initializer.rb +3 -1
  22. data/lib/auth0/mixins/validation.rb +14 -0
  23. data/lib/auth0/version.rb +1 -1
  24. data/spec/integration/lib/auth0/api/v2/api_jobs_spec.rb +1 -1
  25. data/spec/integration/lib/auth0/api/v2/api_user_blocks_spec.rb +1 -1
  26. data/spec/lib/auth0/api/v2/branding_spec.rb +70 -0
  27. data/spec/lib/auth0/api/v2/connections_spec.rb +4 -0
  28. data/spec/lib/auth0/api/v2/jobs_spec.rb +11 -0
  29. data/spec/lib/auth0/api/v2/organizations_spec.rb +593 -0
  30. data/spec/lib/auth0/api/v2/tickets_spec.rb +55 -0
  31. data/spec/lib/auth0/api/v2/users_spec.rb +20 -1
  32. data/spec/lib/auth0/client_spec.rb +79 -9
  33. data/spec/lib/auth0/mixins/httpproxy_spec.rb +8 -8
  34. data/spec/lib/auth0/mixins/validation_spec.rb +32 -0
  35. data/spec/spec_helper.rb +6 -1
  36. metadata +34 -19
  37. data/.github/ISSUE_TEMPLATE.md +0 -39
  38. data/Gemfile.lock +0 -226
@@ -0,0 +1,66 @@
1
+ module Auth0
2
+ module Api
3
+ module V2
4
+ # Methods to use the branding endpoints
5
+ module Branding
6
+ attr_reader :branding_path
7
+
8
+ # Retrieve branding settings.
9
+ # @see https://auth0.com/docs/api/management/v2/#!/Branding/get_branding
10
+ #
11
+ # @return [json] Returns branding settings.
12
+ def branding()
13
+ get(branding_path)
14
+ end
15
+ alias get_branding branding
16
+
17
+ # Update branding settings.
18
+ # @see https://auth0.com/docs/api/management/v2/#!/Branding/patch_branding
19
+ # @param body [hash] the branding settings to update
20
+ #
21
+ # @return [json] Returns branding settings.
22
+ def patch_branding(body = {})
23
+ patch(branding_path, body)
24
+ end
25
+ alias update_branding patch_branding
26
+
27
+ # Get template for New Universal Login Experience
28
+ # @see https://auth0.com/docs/api/management/v2/#!/Branding/get_universal_login
29
+ #
30
+ # @return [json] Returns branding settings.
31
+ def branding_templates_for_universal_login
32
+ get(templates_path)
33
+ end
34
+ alias get_branding_templates_for_universal_login branding_templates_for_universal_login
35
+
36
+ # Delete template for New Universal Login Experience
37
+ # @see https://auth0.com/docs/api/management/v2/#!/Branding/delete_universal_login
38
+ # @param rule_id [string] The id of the rule to delete.
39
+ def delete_branding_templates_for_universal_login
40
+ delete(templates_path)
41
+ end
42
+
43
+ # Set template for New Universal Login Experience
44
+ # @see https://auth0.com/docs/api/management/v2/#!/Branding/put_universal_login
45
+ # @param body [hash] the branding settings to update
46
+ #
47
+ # @return [json] Returns branding settings.
48
+ def put_branding_templates_for_universal_login(body = {})
49
+ put(templates_path, body)
50
+ end
51
+ alias set_branding_templates_for_universal_login put_branding_templates_for_universal_login
52
+
53
+ private
54
+
55
+ # Branding API path
56
+ def branding_path
57
+ @branding_path ||= '/api/v2/branding'
58
+ end
59
+
60
+ def templates_path
61
+ @templates_path ||= "#{branding_path}/templates/universal-login"
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -9,6 +9,7 @@ module Auth0
9
9
  # being specified. Accepts a list of fields to include or exclude in the resulting list of connection objects.
10
10
  # @see https://auth0.com/docs/api/management/v2#!/Connections/get_connections
11
11
  # @param strategy [string] Strategy to filter connection results.
12
+ # @param name [string] Name to filter connection results.
12
13
  # @param fields [string] A comma separated list of fields to include or exclude from the result.
13
14
  # @param include_fields [boolean] True if the fields specified are to be included in the result, false otherwise.
14
15
  # @param page [int] Page number to get, 0-based.
@@ -16,6 +17,7 @@ module Auth0
16
17
  # @return [json] Returns the existing connections matching the strategy.
17
18
  def connections(
18
19
  strategy: nil,
20
+ name: nil,
19
21
  fields: nil,
20
22
  include_fields: nil,
21
23
  page: nil,
@@ -24,6 +26,7 @@ module Auth0
24
26
  include_fields = true if !fields.nil? && include_fields.nil?
25
27
  request_params = {
26
28
  strategy: strategy,
29
+ name: name,
27
30
  fields: fields.is_a?(Array) ? fields.join(',') : fields,
28
31
  include_fields: include_fields,
29
32
  page: !page.nil? ? page.to_i : nil,
@@ -81,13 +81,15 @@ module Auth0
81
81
  # @param identity [hash] Used to verify secondary, federated, and passwordless-email identities.
82
82
  # * :user_id [string] user_id of the identity.
83
83
  # * :provider [string] provider of the identity.
84
+ # @param organization_id [string] organization id
84
85
  #
85
86
  # @return [json] Returns the job status and properties.
86
- def send_verification_email(user_id, client_id = nil, identity: nil)
87
+ def send_verification_email(user_id, client_id = nil, identity: nil, organization_id: nil)
87
88
  raise Auth0::InvalidParameter, 'Must specify a user id' if user_id.to_s.empty?
88
89
 
89
90
  request_params = { user_id: user_id }
90
91
  request_params[:client_id] = client_id unless client_id.nil?
92
+ request_params[:organization_id] = organization_id unless organization_id.nil?
91
93
 
92
94
  if identity
93
95
  unless identity.is_a? Hash
@@ -0,0 +1,335 @@
1
+ module Auth0
2
+ module Api
3
+ module V2
4
+ # Methods to use the organizations endpoints
5
+ module Organizations
6
+ include Auth0::Mixins::Validation
7
+
8
+ attr_reader :organizations_path
9
+
10
+ # Get all organizations.
11
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/get_organizations
12
+ # @param options [hash] The Hash options used to define the paging of rersults
13
+ # * :per_page [integer] The amount of entries per page. Default: 50. Max value: 100.
14
+ # * :page [integer] The page number. Zero based.
15
+ # * :include_totals [boolean] True to include query summary in the result, false or nil otherwise.
16
+ # @return [json] All Organizations
17
+ def organizations(options = {})
18
+ request_params = {
19
+ per_page: options.fetch(:per_page, nil),
20
+ page: options.fetch(:page, nil),
21
+ include_totals: options.fetch(:include_totals, nil)
22
+ }
23
+ get(organizations_path, request_params)
24
+ end
25
+ alias get_organizations organizations
26
+
27
+ # Create a new organization.
28
+ # @see ttps://auth0.com/docs/api/management/v2/#!/Organizations/post_organizations
29
+ # @param options [hash] See https://auth0.com/docs/api/management/v2/#!/Organizations/post_organizations for available options
30
+ # @return [json] Returns the created organization.
31
+ def create_organization(options = {})
32
+ post(organizations_path, options)
33
+ end
34
+
35
+ # Get an organization by id. A token with read:organizations scope is required
36
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/get_organizations_by_id
37
+ # @param organization_id [string] The organization_id of the user to retrieve.
38
+ #
39
+ # @return [json] Returns the organization with the given organization_id if it exists.
40
+ def organization(organization_id)
41
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
42
+ path = "#{organizations_path}/#{organization_id}"
43
+ get(path)
44
+ end
45
+
46
+ # Get an organization by name. A token with read:organizations scope is required.
47
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/get_name_by_name
48
+ # @param organization_name [string] The Organization name
49
+ #
50
+ # @return [json] Returns the organization with the given organization_name if it exists.
51
+ def organization_by_name(organization_name)
52
+ raise Auth0::InvalidParameter, 'Must supply a valid organization_name' if organization_name.to_s.empty?
53
+ path = "#{organizations_path}/name/#{organization_name}"
54
+ get(path)
55
+ end
56
+
57
+
58
+ # Deletes a single organization given its id
59
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/delete_organizations_by_id
60
+ # @param organization_id [string] The Organization ID
61
+ def delete_organization(organization_id)
62
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
63
+ path = "#{organizations_path}/#{organization_id}"
64
+ delete(path)
65
+ end
66
+
67
+ # Update an existing organization.
68
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/patch_organizations_by_id
69
+ # @param organization_id [string] The Organization ID
70
+ # @param body [hash] The optional parameters to update.
71
+ #
72
+ # @return [json] Returns the updated user.
73
+ def patch_organization(organization_id, body)
74
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
75
+ raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?
76
+ path = "#{organizations_path}/#{organization_id}"
77
+ patch(path, body)
78
+ end
79
+ alias update_organization patch_organization
80
+
81
+ ### Organization Enabled Connections
82
+
83
+ # Get enabled connections in an Organization
84
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/get_enabled_connections
85
+ # @param organization_id [string] The Organization ID
86
+ #
87
+ # @return [json] Returns the enabled connections for the given organization
88
+ def get_organizations_enabled_connections(organization_id)
89
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
90
+ path = "#{organizations_enabled_connections_path(organization_id)}"
91
+ get(path)
92
+ end
93
+
94
+ # Get enabled connection by id in an Organization
95
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/get_enabled_connections_by_connectionId
96
+ # @param organization_id [string] The Organization ID
97
+ # @param connection_id [string] The Connection id
98
+ #
99
+ # @return [json] Returns the connection for the given organization
100
+ def get_organizations_enabled_connection(organization_id, connection_id)
101
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
102
+ raise Auth0::InvalidParameter, 'Must supply a valid connection id' if connection_id.to_s.empty?
103
+ path = "#{organizations_enabled_connections_path(organization_id)}/#{connection_id}"
104
+ get(path)
105
+ end
106
+
107
+ # Update an eanbled connection in an Organization
108
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/patch_enabled_connections_by_connectionId
109
+ # @param organization_id [string] The Organization ID
110
+ # @param connection_id [string] The Connection id
111
+ # @param assign_membership_on_login [boolean] flag to allow assign membership on login
112
+ #
113
+ # @return [json] Returns the connection for the given organization
114
+ def patch_organizations_enabled_connection(organization_id, connection_id, assign_membership_on_login: nil)
115
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
116
+ raise Auth0::InvalidParameter, 'Must supply a valid connection id' if connection_id.to_s.empty?
117
+ raise Auth0::InvalidParameter, 'Must supply a valid assign_membership_on_login value' if assign_membership_on_login.nil?
118
+ path = "#{organizations_enabled_connections_path(organization_id)}/#{connection_id}"
119
+
120
+ body = {}
121
+ body[:assign_membership_on_login] = assign_membership_on_login
122
+
123
+ patch(path, body)
124
+ end
125
+ alias update_organizations_enabled_connection patch_organizations_enabled_connection
126
+
127
+ # Add an enabled connection for an Organization
128
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/post_enabled_connections
129
+ # @param organization_id [string] The Organization ID
130
+ # @param connection_id [string] The Organization ID
131
+ # @param assign_membership_on_login [boolean] flag to allow assign membership on login
132
+ #
133
+ # @return [json] Returns the connection for the given organization
134
+ def create_organizations_enabled_connection(organization_id, connection_id, assign_membership_on_login: false)
135
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
136
+ raise Auth0::InvalidParameter, 'Must supply a valid connection id' if connection_id.to_s.empty?
137
+ path = "#{organizations_enabled_connections_path(organization_id)}"
138
+
139
+ body = {}
140
+ body[:assign_membership_on_login] = assign_membership_on_login
141
+ body[:connection_id] = connection_id
142
+
143
+ post(path, body)
144
+ end
145
+ alias add_organizations_enabled_connection create_organizations_enabled_connection
146
+
147
+ # Remove an enabled connection from an Organization
148
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/delete_enabled_connections_by_connectionId
149
+ # @param organization_id [string] The Organization ID
150
+ # @param connection_id [string] The Connection id
151
+ def delete_organizations_enabled_connection(organization_id, connection_id)
152
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
153
+ raise Auth0::InvalidParameter, 'Must supply a valid connection id' if connection_id.to_s.empty?
154
+ path = "#{organizations_enabled_connections_path(organization_id)}/#{connection_id}"
155
+ delete(path)
156
+ end
157
+ alias remove_organizations_enabled_connection delete_organizations_enabled_connection
158
+
159
+ ### Organization Invites
160
+
161
+ # Get invites in an Organization
162
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/get_invitations
163
+ # @param organization_id [string] The Organization ID
164
+ #
165
+ # @return [json] Returns the invites for the given organization
166
+ def get_organizations_invites(organization_id)
167
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
168
+ path = "#{organizations_invitations_path(organization_id)}"
169
+ get(path)
170
+ end
171
+
172
+ # Get invite by id in an Organization
173
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/get_invitations_by_invitation_id
174
+ # @param organization_id [string] The Organization ID
175
+ # @param invitation_id [string] The invitation id
176
+ #
177
+ # @return [json] Returns the invitation for the given organization
178
+ def get_organizations_invite(organization_id, invitation_id)
179
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
180
+ raise Auth0::InvalidParameter, 'Must supply a valid invitation id' if invitation_id.to_s.empty?
181
+ path = "#{organizations_invitations_path(organization_id)}/#{invitation_id}"
182
+ get(path)
183
+ end
184
+
185
+ # Create an invitation in an organization
186
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/post_invitations
187
+ # @param organization_id [string] The Organization ID
188
+ # @param options [hash] See https://auth0.com/docs/api/management/v2/#!/Organizations/post_invitations
189
+ # @return [json] Returns the invitation for the given organization
190
+ def create_organizations_invite(organization_id, options = {})
191
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
192
+ path = "#{organizations_invitations_path(organization_id)}"
193
+
194
+ post(path, options)
195
+ end
196
+ alias add_organizations_invite create_organizations_invite
197
+
198
+ # Delete an invitation to organization
199
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/delete_invitations_by_invitation_id
200
+ # @param organization_id [string] The Organization ID
201
+ # @param invitation_id [string] The Invitation id
202
+ def delete_organizations_invite(organization_id, invitation_id)
203
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
204
+ raise Auth0::InvalidParameter, 'Must supply a valid invitation id' if invitation_id.to_s.empty?
205
+ path = "#{organizations_invitations_path(organization_id)}/#{invitation_id}"
206
+ delete(path)
207
+ end
208
+ alias remove_organizations_invite delete_organizations_invite
209
+
210
+ ### Organization Member
211
+
212
+ # Get Members in a Organization
213
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/get_members
214
+ # @param organization_id [string] The Organization ID
215
+ # @param user_id [string] The User ID
216
+ #
217
+ # @return [json] Returns the members for the given organization
218
+ def get_organizations_members(organization_id)
219
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
220
+ path = "#{organizations_members_path(organization_id)}"
221
+ get(path)
222
+ end
223
+
224
+ # Add members in an organization
225
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/post_members
226
+ # @param organization_id [string] The Organization ID
227
+ # @param members [array] Array of user IDs.
228
+ #
229
+ # @return [json] Returns the invitation for the given organization
230
+ def create_organizations_members(organization_id, members = [])
231
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
232
+ raise Auth0::InvalidParameter, 'Must supply an array of member ids' if members.empty?
233
+ path = "#{organizations_members_path(organization_id)}"
234
+
235
+ body = {}
236
+ body[:members] = members
237
+
238
+ post(path, body)
239
+ end
240
+ alias add_organizations_members create_organizations_members
241
+
242
+ # Remove members from an organization
243
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/delete_members
244
+ # @param organization_id [string] The Organization ID
245
+ # @param members [array] Array of user IDs.
246
+ def delete_organizations_members(organization_id, members = [])
247
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
248
+ raise Auth0::InvalidParameter, 'Must supply an array of member ids' if members.empty?
249
+ path = "#{organizations_members_path(organization_id)}"
250
+
251
+ body = {}
252
+ body[:members] = members
253
+
254
+ delete(path, body)
255
+ end
256
+ alias remove_organizations_members delete_organizations_members
257
+
258
+ ### Organization Member Roles
259
+
260
+ # Get Roles assigned to a Member in an Organization
261
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/get_organization_member_roles
262
+ # @param organization_id [string] The Organization ID
263
+ # @param user_id [string] The User ID
264
+ #
265
+ # @return [json] Returns the member_roles for the given organization
266
+ def get_organizations_member_roles(organization_id, user_id)
267
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
268
+ raise Auth0::InvalidParameter, 'Must supply a valid user id' if user_id.to_s.empty?
269
+ path = "#{organizations_member_roles_path(organization_id, user_id)}"
270
+ get(path)
271
+ end
272
+
273
+ # Assign roles to a member in an organization
274
+ # @see https://auth0.com/docs/api/management/v2/#!/Organizations/post_organization_member_roles
275
+ # @param organization_id [string] The Organization ID
276
+ # @param user_id [string] The User ID
277
+ # @param roles [array] Array of role IDs.
278
+ #
279
+ # @return [json] Returns the invitation for the given organization
280
+ def create_organizations_member_roles(organization_id, user_id, roles = [])
281
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
282
+ raise Auth0::InvalidParameter, 'Must supply a valid user id' if user_id.to_s.empty?
283
+ raise Auth0::InvalidParameter, 'Must supply an array of role ids' if roles.empty?
284
+ path = "#{organizations_member_roles_path(organization_id, user_id)}"
285
+
286
+ body = {}
287
+ body[:roles] = roles
288
+
289
+ post(path, body)
290
+ end
291
+ alias add_organizations_member_roles create_organizations_member_roles
292
+
293
+ # Remove roles from a Member of an organization
294
+ # @https://auth0.com/docs/api/management/v2/#!/Organizations/delete_organization_member_roles
295
+ # @param organization_id [string] The Organization ID
296
+ # @param user_id [string] The User ID
297
+ # @param roles [array] Array of role IDs.
298
+ def delete_organizations_member_roles(organization_id, user_id, roles = [])
299
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
300
+ raise Auth0::InvalidParameter, 'Must supply a valid user id' if user_id.to_s.empty?
301
+ raise Auth0::InvalidParameter, 'Must supply an array of role ids' if roles.empty?
302
+ path = "#{organizations_member_roles_path(organization_id, user_id)}"
303
+
304
+ body = {}
305
+ body[:roles] = roles
306
+
307
+ delete(path, body)
308
+ end
309
+ alias remove_organizations_member_roles delete_organizations_member_roles
310
+
311
+ private
312
+ # Organizations API path
313
+ def organizations_path
314
+ @organizations_path ||= '/api/v2/organizations'
315
+ end
316
+
317
+ def organizations_enabled_connections_path(org_id)
318
+ "#{organizations_path}/#{org_id}/enabled_connections"
319
+ end
320
+
321
+ def organizations_members_path(org_id)
322
+ "#{organizations_path}/#{org_id}/members"
323
+ end
324
+
325
+ def organizations_member_roles_path(org_id, user_id)
326
+ "#{organizations_path}/#{org_id}/members/#{user_id}/roles"
327
+ end
328
+
329
+ def organizations_invitations_path(org_id)
330
+ "#{organizations_path}/#{org_id}/invitations"
331
+ end
332
+ end
333
+ end
334
+ end
335
+ end
@@ -15,9 +15,11 @@ module Auth0
15
15
  # @param identity [hash] Used to verify secondary, federated, and passwordless-email identities.
16
16
  # * :user_id [string] user_id of the identity.
17
17
  # * :provider [string] provider of the identity.
18
+ # @param client_id [string] client id
19
+ # @param organization_id [string] organization id
18
20
  #
19
21
  # @return [json] Returns the created ticket url.
20
- def post_email_verification(user_id, result_url: nil, ttl_sec: nil, identity: nil)
22
+ def post_email_verification(user_id, result_url: nil, ttl_sec: nil, identity: nil, client_id: nil, organization_id: nil)
21
23
  if user_id.to_s.empty?
22
24
  raise Auth0::InvalidParameter, 'Must supply a valid user id to post an email verification'
23
25
  end
@@ -27,6 +29,8 @@ module Auth0
27
29
  result_url: result_url,
28
30
  ttl_sec: ttl_sec.is_a?(Integer) ? ttl_sec : nil
29
31
  }
32
+ request_params[:client_id] = client_id unless client_id.nil?
33
+ request_params[:organization_id] = organization_id unless organization_id.nil?
30
34
 
31
35
  if identity
32
36
  unless identity.is_a? Hash
@@ -53,6 +57,8 @@ module Auth0
53
57
  # @param includeEmailInRedirect [boolean] Whether or not we include the email as part of the returnUrl
54
58
  # in the reset_email
55
59
  # @param new_password [string] The password to be set for the user once the ticket is used.
60
+ # @param client_id [string] client id
61
+ # @param organization_id [string] organization id
56
62
  #
57
63
  # @return [json] Returns the created ticket url.
58
64
  def post_password_change(
@@ -63,7 +69,10 @@ module Auth0
63
69
  ttl_sec: nil,
64
70
  mark_email_as_verified: nil,
65
71
  includeEmailInRedirect: nil,
66
- new_password: nil)
72
+ new_password: nil,
73
+ client_id: nil,
74
+ organization_id: nil
75
+ )
67
76
 
68
77
  booleans = [true, false]
69
78
  path = "#{tickets_path}/password-change"
@@ -77,6 +86,9 @@ module Auth0
77
86
  includeEmailInRedirect: booleans.include?(includeEmailInRedirect) ? includeEmailInRedirect : nil,
78
87
  new_password: new_password
79
88
  }
89
+ request_params[:client_id] = client_id unless client_id.nil?
90
+ request_params[:organization_id] = organization_id unless organization_id.nil?
91
+
80
92
  post(path, request_params)
81
93
  end
82
94