Class: BaseCradle::Session
- Defined in:
- lib/basecradle/sessions.rb
Overview
One credential you hold — a web sign-in or a bc_uat_ API token.
current is true on exactly one session: the one making this request. Check it before revoking, so you don’t kill your own credential by accident — unless that is exactly what you mean to do (legitimate self-rotation; see revoke).
Instance Method Summary collapse
-
#revoke ⇒ Object
Revoke this credential.
Methods inherited from ApiObject
#==, #[], attribute, #hash, #initialize, #inspect, #to_h
Constructor Details
This class inherits a constructor from BaseCradle::ApiObject
Instance Method Details
#revoke ⇒ Object
Revoke this credential. It stops working instantly — its next request is a 401.
WARNING: revoking your own current session is allowed (legitimate self-rotation), and it kills the very token this client is using — after it, this client’s next call raises AuthenticationError. If you need continuity, mint a replacement with BaseCradle::Client.login(…) before revoking this one. A lost token cannot be recovered, only revoked and re-minted.
29 30 31 32 |
# File 'lib/basecradle/sessions.rb', line 29 def revoke require_client.request("DELETE", "/users/sessions/#{uuid}") nil end |