@@ -465,13 +465,45 @@ def user_sessions(user_id)
465
465
get "#{ users_path } /#{ user_id } /sessions"
466
466
end
467
467
468
+ # Retrieve details for a user's refresh tokens.
469
+ # @see https://auth0.com/docs/api/management/v2/users/get-refresh-tokens-for-user
470
+ #
471
+ # @param use_id [String] The user ID
472
+ # @param options [hash] A hash of options for getting permissions
473
+ # * :take [Integer] Number of results per page. Defaults to 50.
474
+ # * :from [String] Optional token ID from which to start selection (exclusive).
475
+ # * :include_totals [boolean] Return results inside an object that contains the total result count (true)
476
+ # or as a direct array of results (false, default)
477
+ #
478
+ # @return [json] Returns refresh tokens for the given user_id.
479
+ def user_refresh_tokens ( user_id , options = { } )
480
+ raise Auth0 ::MissingUserId , 'Must supply a valid user_id' if user_id . to_s . empty?
481
+
482
+ request_params = {
483
+ take : options . fetch ( :take , nil ) ,
484
+ from : options . fetch ( :from , nil ) ,
485
+ include_totals : options . fetch ( :include_totals , nil )
486
+ }
487
+
488
+ get "#{ users_path } /#{ user_id } /refresh-tokens" , request_params
489
+ end
490
+
491
+ # Delete all refresh tokens for a user.
492
+ #
493
+ # @param user_id [String] ID of the user to get remove refresh tokens for
494
+ # @see https://auth0.com/docs/api/management/v2/users/delete-refresh-tokens-for-user
495
+ def delete_user_refresh_tokens ( user_id )
496
+ raise Auth0 ::MissingUserId , 'Must supply a valid user_id' if user_id . to_s . empty?
497
+
498
+ delete "#{ users_path } /#{ user_id } /refresh-tokens"
499
+ end
500
+
468
501
private
469
502
470
503
# Users API path
471
504
def users_path
472
505
@users_path ||= '/api/v2/users'
473
506
end
474
-
475
507
end
476
508
end
477
509
end
0 commit comments