Skip to content

Authentication with JWT fails with HTTP 400 Error #489

@lets-automate-security

Description

@lets-automate-security

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
    Before submitting a bug report, we ask that you first search existing issues and pull requests to see if someone else may have experienced the same issue or may have already submitted a fix for it.

Python Version & Okta SDK Version(s)

Python v3.12.10
okta v3.0.0

Affected Class/Method(s)

okta.api.UserApi.list_users

Customer Information

Organization Name: Sidley
Paid Customer: yes

Code Snippet

from okta.client import Client as OktaClient
config = {
    'orgUrl': 'https://{yourOktaDomain}',
    'token': 'none' #required due to #473 
    'authorizationMode': 'PrivateKey',
    'clientId': '{yourClientId}',
    'scopes': ['okta.users.manage'],
    'privateKey': 'YOUR_PRIVATE_JWK', # this parameter should be type of str
    'kid': 'YOUR_PRIVATE_KEY_ID' # if a key ID needs to be provided, it can be provided here or part of the privateKey under "kid"
}
okta_client = OktaClient(config)


# example of usage, list all users and print their first name and last name
async def main():
    users, resp, err = await okta_client.list_users()
    for user in users:
        print(user.profile.first_name, user.profile.last_name)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())


### Debug Output / Traceback

`{'message': "HTTP 400 {'error': 'invalid_request', 'error_description': 'Duplicate parameter provided in request. Duplicated parameters: [client_assertion].'}"}`

Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "user_query.py", line 31, in
loop.run_until_complete(main())
File "C:\Users<user>\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 691, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\user_query.py", line 27, in main
for user in users:
^^^^^
TypeError: 'NoneType' object is not iterable


### Expected Behavior

The code should work and return users like it does in 2.9.13

### Actual Behavior

The code returns the HTTP error `{'message': "HTTP 400 {'error': 'invalid_request', 'error_description': 'Duplicate parameter provided in request. Duplicated parameters: [client_assertion].'}"}`

### Steps to reproduce

1. Run the code snippet provided above. with an RSA key supplied and the correct client ID

### References

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions