Login request not working - Code of length 6 returned instead of len32

Hey. I am trying to generate the access token after login, but the redirect url returns with a code of length 6, instead of the 32-len code.
Can you please assist.

What I get after visiting the auth URL: LOGIN_URL = Login to Upstox

You need to obtain an access token by utilizing the Get Token API, accessible at this URL: Get Token | Upstox Developer API

The six-digit code you receive at this link,, represents an auth code. This code serves as input for generating an access token also with other parameters mentioned in the document.

It’s important to note that the authentication code is valid for a single use only while generating access token.

So is the “P2TWEw” code correct? Shouldn’t this be a longer code?
Because when I use that as authorization code, to get the access token, I get the below error:
“Error: Non-base32 digit found”

Enter the authentication code from the URL: YmnHRi
Traceback (most recent call last):

File ~/anaconda3/lib/python3.10/site-packages/spyder_kernels/py3compat.py:356 in compat_exec
exec(code, globals, locals)

File ~/Coding/Trading/jayBuyAlertApp_upstox/upstox_authenticate.py:57

File ~/Coding/Trading/jayBuyAlertApp_upstox/upstox_authenticate.py:50 in main
totp = generate_totp(SECRET_2FA)

File ~/Coding/Trading/jayBuyAlertApp_upstox/upstox_authenticate.py:20 in generate_totp
return totp.now()

File ~/anaconda3/lib/python3.10/site-packages/pyotp/totp.py:64 in now
return self.generate_otp(self.timecode(datetime.datetime.now()))

File ~/anaconda3/lib/python3.10/site-packages/pyotp/otp.py:35 in generate_otp
hasher = hmac.new(self.byte_secret(), self.int_to_bytestring(input), self.digest)

File ~/anaconda3/lib/python3.10/site-packages/pyotp/otp.py:52 in byte_secret
return base64.b32decode(secret, casefold=True)

File ~/anaconda3/lib/python3.10/base64.py:253 in b32decode
return _b32decode(_b32alphabet, s, casefold, map01)

File ~/anaconda3/lib/python3.10/base64.py:235 in _b32decode
raise binascii.Error(‘Non-base32 digit found’) from None

Error: Non-base32 digit found

P2TWEw is your 6-digit auth code which is correct. After obtaining the auth code, please refer the following gist for instructions on generating the access token: Generate Access Token · GitHub