Module: Auth0::Api::V2::Sessions

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

Overview

Methods to use the Session endpoints

Instance Method Summary collapse

Instance Method Details

#delete_session(session_id) ⇒ Object

Deletes a session by id

Parameters:

  • id (string)

    The id of the session to delete.

Raises:

See Also:



20
21
22
23
24
# File 'lib/auth0/api/v2/sessions.rb', line 20

def delete_session(session_id)
  raise Auth0::InvalidParameter, 'Must supply a valid session_id' if session_id.to_s.empty?

  delete "#{sessions_path}/#{session_id}"
end

#revoke_session(session_id) ⇒ Object

Revokes a session by ID and all associated refresh tokens

Parameters:

  • id (string)

    The ID of the session to revoke

Raises:

See Also:



29
30
31
32
33
# File 'lib/auth0/api/v2/sessions.rb', line 29

def revoke_session(session_id)
  raise Auth0::InvalidParameter, 'Must supply a valid session_id' if session_id.to_s.empty?

  post "#{sessions_path}/#{session_id}/revoke"
end

#session(session_id) ⇒ Object

Retrieve session information by id

Parameters:

  • id (string)

    The id of the session to retrieve.

Raises:

See Also:



11
12
13
14
15
# File 'lib/auth0/api/v2/sessions.rb', line 11

def session(session_id)
  raise Auth0::InvalidParameter, 'Must supply a valid session_id' if session_id.to_s.empty?

  get "#{sessions_path}/#{session_id}"
end