Module: Auth0::Api::V2::Tickets

Included in:
Auth0::Api::V2
Defined in:
lib/auth0/api/v2/tickets.rb

Overview

Methods to use the tickets endpoints

Instance Method Summary collapse

Instance Method Details

#post_email_verification(user_id, result_url: nil) ⇒ json

Create an email verification ticket

Parameters:

  • user_id (string)

    The user_id of for which the ticket is to be created.

  • result_url (string) (defaults to: nil)

    The user will be redirected to this endpoint once the ticket is used.

Returns:

  • (json)

    Returns the created ticket url.

See Also:



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/auth0/api/v2/tickets.rb', line 14

def post_email_verification(user_id, result_url: nil)
  if user_id.to_s.empty?
    raise Auth0::InvalidParameter, 'Must supply a valid user id to post an email verification'
  end
  path = "#{tickets_path}/email-verification"
  request_params = {
    user_id: user_id,
    result_url: result_url
  }
  post(path, request_params)
end

#post_password_change(new_password: nil, user_id: nil, result_url: nil, connection_id: nil, email: nil) ⇒ json

Create a password change ticket changed. If sending this parameter, the email is also required and the user_id is invalid.

Parameters:

  • new_password (string) (defaults to: nil)

    The password to be set for the user once the ticket is used.

  • user_id (string) (defaults to: nil)

    The user_id of for which the ticket is to be created.

  • result_url (string) (defaults to: nil)

    The user will be redirected to this endpoint once the ticket is used.

  • connection_id (string) (defaults to: nil)

    The connection that provides the identity for which the password is to be

  • email (string) (defaults to: nil)

    The user’s email.

Returns:

  • (json)

    Returns the created ticket url.

See Also:



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/auth0/api/v2/tickets.rb', line 36

def post_password_change(new_password: nil, user_id: nil, result_url: nil, connection_id: nil, email: nil)
  path = "#{tickets_path}/password-change"
  request_params = {
    user_id: user_id,
    result_url: result_url,
    new_password: new_password,
    connection_id: connection_id,
    email: email
  }
  post(path, request_params)
end