Login error with dh-906 order error

Error at Gettting balance as {‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘DH-906’, ‘error_type’: ‘Order_Error’, ‘error_message’: ‘Invalid Token’}, ‘data’: ‘’}

im getting this error since march 19 evening even after refereshing token .
what could be the reason ?

@vrushal_yadav Try code from here.

Hey @vrushal_yadav ,

We request you to kindly confirm whether you are generating the access token from the web portal web.dhan.co or via the API key-based login and TOTP setup flow.

Additionally, we recommend you to review the authentication flow for generating an access token using the documentation https://dhanhq.co/docs/v2/authentication/#api-key-secret

You may also share your registered details with us over apihelp@dhan.co so that we can assist you better.

even after regenerating and refreshing access token ,it is still this giving this error .

Hi @vrushal_yadav ,

It looks like the token may have expired or become invalid. Please delete the existing token file from the folder, generate a new token, and then re-run the system.

Also, it would be better to switch to the TOTP + PIN -based login method. With this approach, the token will be generated automatically, eliminating the need for manual regeneration.

Refer the link -

im using 3.13.1 is it okay or should i downgrade the version to 3.12?