FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Generated api key not an UUID but required in Python client

    Scheduled Pinned Locked Moved
    Q&A
    2
    3
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Y
      yet
      last edited by

      I am playing with FusionAuth and created some API keys:

      Bildschirmfoto 2020-05-04 um 18.59.15.png

      The Python client seems to require a valid UUID a api key since the following code does not work (taken from the Python client examples):

      
      client = FusionAuthClient('4zs15CcJJsczlYjeL62bltfbsqbxMZp4m43epG56gsA', 'http://127.0.0.1:9011')
      
      user_request = {
          'sendSetPasswordEmail': False,
          'skipVerification': True,
          'user': {
              'email': 'art@vandaleyindustries.com',
              'password': 'password'
          }
      }
      
      client_response = client.create_user(None, user_request)
      

      The API return this

      {'error_response': {'fieldErrors': {'user': [{'code': '[missing]user', 'message': 'Your request is missing the User information as JSON in the entity-body.'}], 'userId': [{'code': '[couldNotConvert]userId', 'message': "Invalid userId on the URL [{'sendSetPasswordEmail': False, 'skipVerification': True, 'user': {'email': 'art@vandaleyindustries.com', 'password': 'password'}}]. This must be a valid UUID String (e.g. 25a872da-bb44-4af8-a43d-e7bcb5351ebc)."}]}}, 'exception': None, 'response': <Response [400]>, 'success_response': None, 'status': 400}
      
      

      The error is obviously This must be a valid UUID String but why does not FusionAuth create a proper UUID? Even creating a new API key with my own provided UUID causes the same issue...anything I am missing here?

      1 Reply Last reply Reply Quote 0
      • danD
        dan
        last edited by

        Hiya,

        It looks like there's an error in our sample code.

        If you replace
        client_response = client.create_user(None, user_request)
        with
        client_response = client.create_user(user_request)
        then the user is created.

        I will file an issue on that library repo.

        Hope this helps.

        --
        FusionAuth - Auth for devs, built by devs.
        https://fusionauth.io

        1 Reply Last reply Reply Quote 0
        • danD
          dan
          last edited by

          Ah, looks like someone else already shared a fix. https://github.com/FusionAuth/fusionauth-python-client/pull/6

          --
          FusionAuth - Auth for devs, built by devs.
          https://fusionauth.io

          1 Reply Last reply Reply Quote 0
          • First post
            Last post