Class: Stytch::M2M::Clients::Secrets
- Inherits:
-
Object
- Object
- Stytch::M2M::Clients::Secrets
- Includes:
- RequestHelper
- Defined in:
- lib/stytch/m2m.rb
Instance Method Summary collapse
-
#initialize(connection) ⇒ Secrets
constructor
A new instance of Secrets.
-
#rotate(client_id:) ⇒ Object
Complete the rotation of an M2M client secret started with the [Start Secret Rotation Endpoint](stytch.com/docs/b2b/api/m2m-rotate-secret-start) [Start Secret Rotation Endpoint](stytch.com/docs/api/m2m-rotate-secret-start).
-
#rotate_cancel(client_id:) ⇒ Object
Cancel the rotation of an M2M client secret started with the [Start Secret Rotation Endpoint](stytch.com/docs/b2b/api/m2m-rotate-secret-start) [Start Secret Rotation Endpoint](stytch.com/docs/api/m2m-rotate-secret-start).
-
#rotate_start(client_id:) ⇒ Object
Initiate the rotation of an M2M client secret.
Methods included from RequestHelper
#delete_request, #get_request, #post_request, #put_request, #request_with_query_params
Constructor Details
#initialize(connection) ⇒ Secrets
Returns a new instance of Secrets.
387 388 389 |
# File 'lib/stytch/m2m.rb', line 387 def initialize(connection) @connection = connection end |
Instance Method Details
#rotate(client_id:) ⇒ Object
Complete the rotation of an M2M client secret started with the [Start Secret Rotation Endpoint](stytch.com/docs/b2b/api/m2m-rotate-secret-start) [Start Secret Rotation Endpoint](stytch.com/docs/api/m2m-rotate-secret-start). After this endpoint is called, the client’s ‘next_client_secret` becomes its `client_secret` and the previous `client_secret` will no longer be valid.
Parameters:
- client_id
-
The ID of the client. The type of this field is
String
.
Returns:
An object with the following fields:
- request_id
-
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is
String
. - m2m_client
-
The M2M Client affected by this operation. The type of this field is
M2MClient
(object
). - status_code
-
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is
Integer
.
468 469 470 471 472 473 474 475 |
# File 'lib/stytch/m2m.rb', line 468 def rotate( client_id: ) headers = {} request = {} post_request("/v1/m2m/clients/#{client_id}/secrets/rotate", request, headers) end |
#rotate_cancel(client_id:) ⇒ Object
Cancel the rotation of an M2M client secret started with the [Start Secret Rotation Endpoint](stytch.com/docs/b2b/api/m2m-rotate-secret-start) [Start Secret Rotation Endpoint](stytch.com/docs/api/m2m-rotate-secret-start). After this endpoint is called, the client’s ‘next_client_secret` is discarded and only the original `client_secret` will be valid.
Parameters:
- client_id
-
The ID of the client. The type of this field is
String
.
Returns:
An object with the following fields:
- request_id
-
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is
String
. - m2m_client
-
The M2M Client affected by this operation. The type of this field is
M2MClient
(object
). - status_code
-
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is
Integer
.
440 441 442 443 444 445 446 447 |
# File 'lib/stytch/m2m.rb', line 440 def rotate_cancel( client_id: ) headers = {} request = {} post_request("/v1/m2m/clients/#{client_id}/secrets/rotate/cancel", request, headers) end |
#rotate_start(client_id:) ⇒ Object
Initiate the rotation of an M2M client secret. After this endpoint is called, both the client’s ‘client_secret` and `next_client_secret` will be valid. To complete the secret rotation flow, update all usages of `client_secret` to `next_client_secret` and call the [Rotate Secret Endpoint](stytch.com/docs/b2b/api/m2m-rotate-secret)[Rotate Secret Endpoint](stytch.com/docs/api/m2m-rotate-secret) to complete the flow. Secret rotation can be cancelled using the [Rotate Cancel Endpoint](stytch.com/docs/b2b/api/m2m-rotate-secret-cancel)[Rotate Cancel Endpoint](stytch.com/docs/api/m2m-rotate-secret-cancel).
Important: This is the only time you will be able to view the generated ‘next_client_secret` in the API response. Stytch stores a hash of the `next_client_secret` and cannot recover the value if lost. Be sure to persist the `next_client_secret` in a secure location. If the `next_client_secret` is lost, you will need to trigger a secret rotation flow to receive another one.
Parameters:
- client_id
-
The ID of the client. The type of this field is
String
.
Returns:
An object with the following fields:
- request_id
-
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is
String
. - m2m_client
-
The M2M Client affected by this operation. The type of this field is
M2MClientWithNextClientSecret
(object
). - status_code
-
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is
Integer
.
412 413 414 415 416 417 418 419 |
# File 'lib/stytch/m2m.rb', line 412 def rotate_start( client_id: ) headers = {} request = {} post_request("/v1/m2m/clients/#{client_id}/secrets/rotate/start", request, headers) end |