Not able to generate access token using refresh token.

Hi team, i am not able to generate access token using refresh token today. Till yesterday, everything went well with same code. I tried generating new refresh token using new auth id, deleting and creating the new api app in the console. Also i tried after upgrading fyers python package. Nothing worked. Attaching sample code and errors.

Error:

Status Code 400

JSON Response {'s': 'error', 'code': -371, 'message': 'Please provide sha256 hash of appId and app secret'}

Note: i have provided correct sha256 of app id and secret as mentioned in the documentation.

code:

url = "https://api-t1.fyers.in/api/v3/validate-refresh-token"
            
            headers = {"Content-Type": "application/json; charset=utf-8"}
            
            data = {
              "grant_type": "refresh_token",
              "appIdHash": 'SHA256 of client_id+secret',
              "refresh_token": 'refresh_token',
              "pin": "pin"
            }
            response = requests.post(url, headers=headers, json=data)
            
            print("Status Code", response.status_code)
            print("JSON Response ", response.json())

Also as a work around, i generated access token using new auth code manually. But still not able to generate live data. Throwing below error.

Error: {'code': 12001, 'message': 'Mode change failed', 's': 'error'}

Error: {'type': 'sub', 'code': 11011, 'message': 'subscription failed', 's': 'error'}

Please let me know what is wrong with my account.

3 replies