1
1
#
2
- # Copyright (c) 2018-2023 , FusionAuth, All Rights Reserved
2
+ # Copyright (c) 2018-2025 , FusionAuth, All Rights Reserved
3
3
#
4
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
5
# you may not use this file except in compliance with the License.
@@ -129,6 +129,7 @@ def change_password(self, change_password_id, request):
129
129
.post () \
130
130
.go ()
131
131
132
+ @deprecated ("This method has been renamed to change_password_using_jwt, use that method instead." )
132
133
def change_password_by_jwt (self , encoded_jwt , request ):
133
134
"""
134
135
Changes a user's password using their access token (JWT) instead of the changePasswordId
@@ -160,6 +161,23 @@ def change_password_by_identity(self, request):
160
161
.post () \
161
162
.go ()
162
163
164
+ def change_password_using_jwt (self , encoded_jwt , request ):
165
+ """
166
+ Changes a user's password using their access token (JWT) instead of the changePasswordId
167
+ A common use case for this method will be if you want to allow the user to change their own password.
168
+
169
+ Remember to send refreshToken in the request body if you want to get a new refresh token when login using the returned oneTimePassword.
170
+
171
+ Attributes:
172
+ encoded_jwt: The encoded JWT (access token).
173
+ request: The change password request that contains all the information used to change the password.
174
+ """
175
+ return self .start_anonymous ().uri ('/api/user/change-password' ) \
176
+ .authorization ("Bearer " + encoded_jwt ) \
177
+ .body_handler (JSONBodyHandler (request )) \
178
+ .post () \
179
+ .go ()
180
+
163
181
def check_change_password_using_id (self , change_password_id ):
164
182
"""
165
183
Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
@@ -760,7 +778,7 @@ def deactivate_user_action(self, user_action_id):
760
778
@deprecated ("This method has been renamed to deactivate_users_by_ids, use that method instead." )
761
779
def deactivate_users (self , user_ids ):
762
780
"""
763
- Deactivates the users with the given ids .
781
+ Deactivates the users with the given Ids .
764
782
765
783
Attributes:
766
784
user_ids: The ids of the users to deactivate.
@@ -774,7 +792,7 @@ def deactivate_users(self, user_ids):
774
792
775
793
def deactivate_users_by_ids (self , user_ids ):
776
794
"""
777
- Deactivates the users with the given ids .
795
+ Deactivates the users with the given Ids .
778
796
779
797
Attributes:
780
798
user_ids: The ids of the users to deactivate.
@@ -1217,8 +1235,8 @@ def delete_user_with_request(self, user_id, request):
1217
1235
@deprecated ("This method has been renamed to delete_users_by_query, use that method instead." )
1218
1236
def delete_users (self , request ):
1219
1237
"""
1220
- Deletes the users with the given ids , or users matching the provided JSON query or queryString.
1221
- The order of preference is ids , query and then queryString, it is recommended to only provide one of the three for the request.
1238
+ Deletes the users with the given Ids , or users matching the provided JSON query or queryString.
1239
+ The order of preference is Ids , query and then queryString, it is recommended to only provide one of the three for the request.
1222
1240
1223
1241
This method can be used to deactivate or permanently delete (hard-delete) users based upon the hardDelete boolean in the request body.
1224
1242
Using the dryRun parameter you may also request the result of the action without actually deleting or deactivating any users.
@@ -1233,8 +1251,8 @@ def delete_users(self, request):
1233
1251
1234
1252
def delete_users_by_query (self , request ):
1235
1253
"""
1236
- Deletes the users with the given ids , or users matching the provided JSON query or queryString.
1237
- The order of preference is ids , query and then queryString, it is recommended to only provide one of the three for the request.
1254
+ Deletes the users with the given Ids , or users matching the provided JSON query or queryString.
1255
+ The order of preference is Ids , query and then queryString, it is recommended to only provide one of the three for the request.
1238
1256
1239
1257
This method can be used to deactivate or permanently delete (hard-delete) users based upon the hardDelete boolean in the request body.
1240
1258
Using the dryRun parameter you may also request the result of the action without actually deleting or deactivating any users.
@@ -1756,7 +1774,7 @@ def modify_action(self, action_id, request):
1756
1774
action.
1757
1775
1758
1776
Attributes:
1759
- action_id: The Id of the action to modify. This is technically the user action log id .
1777
+ action_id: The Id of the action to modify. This is technically the user action log Id .
1760
1778
request: The request that contains all the information about the modification.
1761
1779
"""
1762
1780
return self .start ().uri ('/api/user/action' ) \
@@ -1779,16 +1797,16 @@ def passwordless_login(self, request):
1779
1797
1780
1798
def patch_api_key (self , key_id , request ):
1781
1799
"""
1782
- Updates an authentication API key by given id
1800
+ Updates an API key with the given Id.
1783
1801
1784
1802
Attributes:
1785
- key_id: The Id of the authentication key. If not provided a secure random api key will be generated.
1786
- request: The request object that contains all the information needed to create the APIKey .
1803
+ key_id: The Id of the API key. If not provided a secure random api key will be generated.
1804
+ request: The request object that contains all the information needed to create the API key .
1787
1805
"""
1788
1806
return self .start ().uri ('/api/api-key' ) \
1789
1807
.url_segment (key_id ) \
1790
1808
.body_handler (JSONBodyHandler (request )) \
1791
- .post () \
1809
+ .patch () \
1792
1810
.go ()
1793
1811
1794
1812
def patch_application (self , application_id , request ):
@@ -2297,7 +2315,7 @@ def reindex(self, request):
2297
2315
2298
2316
def remove_user_from_family (self , family_id , user_id ):
2299
2317
"""
2300
- Removes a user from the family with the given id .
2318
+ Removes a user from the family with the given Id .
2301
2319
2302
2320
Attributes:
2303
2321
family_id: The Id of the family to remove the user from.
@@ -2352,7 +2370,7 @@ def resend_registration_verification(self, email, application_id):
2352
2370
2353
2371
def retrieve_api_key (self , key_id ):
2354
2372
"""
2355
- Retrieves an authentication API key for the given id
2373
+ Retrieves an authentication API key for the given Id.
2356
2374
2357
2375
Attributes:
2358
2376
key_id: The Id of the API key to retrieve.
@@ -2419,7 +2437,7 @@ def retrieve_application(self, application_id=None):
2419
2437
Retrieves the application for the given Id or all the applications if the Id is null.
2420
2438
2421
2439
Attributes:
2422
- application_id: (Optional) The application id .
2440
+ application_id: (Optional) The application Id .
2423
2441
"""
2424
2442
return self .start ().uri ('/api/application' ) \
2425
2443
.url_segment (application_id ) \
@@ -2494,11 +2512,11 @@ def retrieve_consents(self):
2494
2512
2495
2513
def retrieve_daily_active_report (self , start , end , application_id = None ):
2496
2514
"""
2497
- Retrieves the daily active user report between the two instants. If you specify an application id , it will only
2515
+ Retrieves the daily active user report between the two instants. If you specify an application Id , it will only
2498
2516
return the daily active counts for that application.
2499
2517
2500
2518
Attributes:
2501
- application_id: (Optional) The application id .
2519
+ application_id: (Optional) The application Id .
2502
2520
start: The start instant as UTC milliseconds since Epoch.
2503
2521
end: The end instant as UTC milliseconds since Epoch.
2504
2522
"""
@@ -2511,7 +2529,7 @@ def retrieve_daily_active_report(self, start, end, application_id=None):
2511
2529
2512
2530
def retrieve_email_template (self , email_template_id = None ):
2513
2531
"""
2514
- Retrieves the email template for the given Id. If you don't specify the id , this will return all the email templates.
2532
+ Retrieves the email template for the given Id. If you don't specify the Id , this will return all the email templates.
2515
2533
2516
2534
Attributes:
2517
2535
email_template_id: (Optional) The Id of the email template.
@@ -2894,11 +2912,11 @@ def retrieve_lambdas_by_type(self, _type):
2894
2912
2895
2913
def retrieve_login_report (self , start , end , application_id = None ):
2896
2914
"""
2897
- Retrieves the login report between the two instants. If you specify an application id , it will only return the
2915
+ Retrieves the login report between the two instants. If you specify an application Id , it will only return the
2898
2916
login counts for that application.
2899
2917
2900
2918
Attributes:
2901
- application_id: (Optional) The application id .
2919
+ application_id: (Optional) The application Id .
2902
2920
start: The start instant as UTC milliseconds since Epoch.
2903
2921
end: The end instant as UTC milliseconds since Epoch.
2904
2922
"""
@@ -2911,7 +2929,7 @@ def retrieve_login_report(self, start, end, application_id=None):
2911
2929
2912
2930
def retrieve_message_template (self , message_template_id = None ):
2913
2931
"""
2914
- Retrieves the message template for the given Id. If you don't specify the id , this will return all the message templates.
2932
+ Retrieves the message template for the given Id. If you don't specify the Id , this will return all the message templates.
2915
2933
2916
2934
Attributes:
2917
2935
message_template_id: (Optional) The Id of the message template.
@@ -2967,11 +2985,11 @@ def retrieve_messengers(self):
2967
2985
2968
2986
def retrieve_monthly_active_report (self , start , end , application_id = None ):
2969
2987
"""
2970
- Retrieves the monthly active user report between the two instants. If you specify an application id , it will only
2988
+ Retrieves the monthly active user report between the two instants. If you specify an application Id , it will only
2971
2989
return the monthly active counts for that application.
2972
2990
2973
2991
Attributes:
2974
- application_id: (Optional) The application id .
2992
+ application_id: (Optional) The application Id .
2975
2993
start: The start instant as UTC milliseconds since Epoch.
2976
2994
end: The end instant as UTC milliseconds since Epoch.
2977
2995
"""
@@ -3133,7 +3151,7 @@ def retrieve_refresh_tokens(self, user_id):
3133
3151
3134
3152
def retrieve_registration (self , user_id , application_id ):
3135
3153
"""
3136
- Retrieves the user registration for the user with the given Id and the given application id .
3154
+ Retrieves the user registration for the user with the given Id and the given application Id .
3137
3155
3138
3156
Attributes:
3139
3157
user_id: The Id of the user.
@@ -3147,11 +3165,11 @@ def retrieve_registration(self, user_id, application_id):
3147
3165
3148
3166
def retrieve_registration_report (self , start , end , application_id = None ):
3149
3167
"""
3150
- Retrieves the registration report between the two instants. If you specify an application id , it will only return
3168
+ Retrieves the registration report between the two instants. If you specify an application Id , it will only return
3151
3169
the registration counts for that application.
3152
3170
3153
3171
Attributes:
3154
- application_id: (Optional) The application id .
3172
+ application_id: (Optional) The application Id .
3155
3173
start: The start instant as UTC milliseconds since Epoch.
3156
3174
end: The end instant as UTC milliseconds since Epoch.
3157
3175
"""
@@ -3313,7 +3331,7 @@ def retrieve_user(self, user_id):
3313
3331
3314
3332
def retrieve_user_action (self , user_action_id = None ):
3315
3333
"""
3316
- Retrieves the user action for the given Id. If you pass in null for the id , this will return all the user
3334
+ Retrieves the user action for the given Id. If you pass in null for the Id , this will return all the user
3317
3335
actions.
3318
3336
3319
3337
Attributes:
@@ -3326,7 +3344,7 @@ def retrieve_user_action(self, user_action_id=None):
3326
3344
3327
3345
def retrieve_user_action_reason (self , user_action_reason_id = None ):
3328
3346
"""
3329
- Retrieves the user action reason for the given Id. If you pass in null for the id , this will return all the user
3347
+ Retrieves the user action reason for the given Id. If you pass in null for the Id , this will return all the user
3330
3348
action reasons.
3331
3349
3332
3350
Attributes:
@@ -3440,8 +3458,8 @@ def retrieve_user_code(self, client_id, client_secret, user_code):
3440
3458
This API is useful if you want to build your own login workflow to complete a device grant.
3441
3459
3442
3460
Attributes:
3443
- client_id: The client id .
3444
- client_secret: The client id .
3461
+ client_id: The client Id .
3462
+ client_secret: The client Id .
3445
3463
user_code: The end-user verification code.
3446
3464
"""
3447
3465
body = {
@@ -3553,12 +3571,12 @@ def retrieve_user_links_by_user_id(self, user_id, identity_provider_id=None):
3553
3571
3554
3572
def retrieve_user_login_report (self , user_id , start , end , application_id = None ):
3555
3573
"""
3556
- Retrieves the login report between the two instants for a particular user by Id. If you specify an application id , it will only return the
3574
+ Retrieves the login report between the two instants for a particular user by Id. If you specify an application Id , it will only return the
3557
3575
login counts for that application.
3558
3576
3559
3577
Attributes:
3560
- application_id: (Optional) The application id .
3561
- user_id: The userId id .
3578
+ application_id: (Optional) The application Id .
3579
+ user_id: The userId Id .
3562
3580
start: The start instant as UTC milliseconds since Epoch.
3563
3581
end: The end instant as UTC milliseconds since Epoch.
3564
3582
"""
@@ -3572,12 +3590,12 @@ def retrieve_user_login_report(self, user_id, start, end, application_id=None):
3572
3590
3573
3591
def retrieve_user_login_report_by_login_id (self , login_id , start , end , application_id = None ):
3574
3592
"""
3575
- Retrieves the login report between the two instants for a particular user by login Id. If you specify an application id , it will only return the
3593
+ Retrieves the login report between the two instants for a particular user by login Id. If you specify an application Id , it will only return the
3576
3594
login counts for that application.
3577
3595
3578
3596
Attributes:
3579
- application_id: (Optional) The application id .
3580
- login_id: The userId id .
3597
+ application_id: (Optional) The application Id .
3598
+ login_id: The userId Id .
3581
3599
start: The start instant as UTC milliseconds since Epoch.
3582
3600
end: The end instant as UTC milliseconds since Epoch.
3583
3601
"""
@@ -3674,7 +3692,7 @@ def retrieve_web_authn_credentials_for_user(self, user_id):
3674
3692
3675
3693
def retrieve_webhook (self , webhook_id = None ):
3676
3694
"""
3677
- Retrieves the webhook for the given Id. If you pass in null for the id , this will return all the webhooks.
3695
+ Retrieves the webhook for the given Id. If you pass in null for the Id , this will return all the webhooks.
3678
3696
3679
3697
Attributes:
3680
3698
webhook_id: (Optional) The Id of the webhook.
@@ -3906,7 +3924,7 @@ def search_entities(self, request):
3906
3924
3907
3925
def search_entities_by_ids (self , ids ):
3908
3926
"""
3909
- Retrieves the entities for the given ids . If any Id is invalid, it is ignored.
3927
+ Retrieves the entities for the given Ids . If any Id is invalid, it is ignored.
3910
3928
3911
3929
Attributes:
3912
3930
ids: The entity ids to search for.
@@ -4075,7 +4093,7 @@ def search_user_comments(self, request):
4075
4093
@deprecated ("This method has been renamed to search_users_by_ids, use that method instead." )
4076
4094
def search_users (self , ids ):
4077
4095
"""
4078
- Retrieves the users for the given ids . If any Id is invalid, it is ignored.
4096
+ Retrieves the users for the given Ids . If any Id is invalid, it is ignored.
4079
4097
4080
4098
Attributes:
4081
4099
ids: The user ids to search for.
@@ -4087,10 +4105,10 @@ def search_users(self, ids):
4087
4105
4088
4106
def search_users_by_ids (self , ids ):
4089
4107
"""
4090
- Retrieves the users for the given ids . If any Id is invalid, it is ignored.
4108
+ Retrieves the users for the given Ids . If any Id is invalid, it is ignored.
4091
4109
4092
4110
Attributes:
4093
- ids: The user ids to search for.
4111
+ ids: The user Ids to search for.
4094
4112
"""
4095
4113
return self .start ().uri ('/api/user/search' ) \
4096
4114
.url_parameter ('ids' , self .convert_true_false (ids )) \
@@ -4150,7 +4168,7 @@ def search_webhooks(self, request):
4150
4168
4151
4169
def send_email (self , email_template_id , request ):
4152
4170
"""
4153
- Send an email using an email template id . You can optionally provide <code>requestData</code> to access key value
4171
+ Send an email using an email template Id . You can optionally provide <code>requestData</code> to access key value
4154
4172
pairs in the email template.
4155
4173
4156
4174
Attributes:
@@ -4343,16 +4361,16 @@ def two_factor_login(self, request):
4343
4361
.post () \
4344
4362
.go ()
4345
4363
4346
- def update_api_key (self , api_key_id , request ):
4364
+ def update_api_key (self , key_id , request ):
4347
4365
"""
4348
- Updates an API key by given id
4366
+ Updates an API key with the given Id.
4349
4367
4350
4368
Attributes:
4351
- api_key_id : The Id of the API key to update.
4352
- request: The request object that contains all the information used to create the API Key .
4369
+ key_id : The Id of the API key to update.
4370
+ request: The request that contains all the new API key information .
4353
4371
"""
4354
4372
return self .start ().uri ('/api/api-key' ) \
4355
- .url_segment (api_key_id ) \
4373
+ .url_segment (key_id ) \
4356
4374
.body_handler (JSONBodyHandler (request )) \
4357
4375
.put () \
4358
4376
.go ()
@@ -4802,7 +4820,7 @@ def validate_device(self, user_code, client_id):
4802
4820
4803
4821
Attributes:
4804
4822
user_code: The end-user verification code.
4805
- client_id: The client id .
4823
+ client_id: The client Id .
4806
4824
"""
4807
4825
return self .start_anonymous ().uri ('/oauth2/device/validate' ) \
4808
4826
.url_parameter ('user_code' , self .convert_true_false (user_code )) \
0 commit comments