2

I want to use the input function in python3 to ask the user a jwt token.

Unfortunately, I'm reaching the length limit of this function (I think).

The length of my jwt token is 1130 characters

When I'm pasting my token into the input, I'm facing a blocker and its truncated.

Do you see any workaround or another way to do this ?

    # if config is empty, load using input() functions
    if not cdp_token:
        cdp_token = input("Token JWT Empty! Please Enter your cdh api token (https://mysite/profile):\n")
zoph
  • 822
  • 1
  • 8
  • 15
  • Does this answer your question? [How big can the input to the input() function be?](https://stackoverflow.com/questions/40598483/how-big-can-the-input-to-the-input-function-be) – marcusshep Oct 06 '20 at 13:32
  • Not really as the limit is very light in my case, only 1130 characters! we don't reach python string limit with only a few characters, and If the string comes from my config file, I was able to manipulate it easy with the same length. The issue is located at input level function – zoph Oct 06 '20 at 15:21

1 Answers1

1

You can use concept of hashing. Try hashing your token to something small, may be using SHA or any standard algorithm. When you check the token from database/repository you can hash that db token as well and compare it in your function. I think this can be a good approach.