The token is invalid


  • below code not working from today [3-1-2023], It was working fine. any change in that?

    SmartApi connect = new SmartApi(api_key, JWTToken, RefreshToken);
    //SmartApi connect = new SmartApi(api_key);
    OutputBaseClass obj = new OutputBaseClass();
    GetTotp();
    //Login by client code and password
    obj = connect.GenerateSession(Client_code, Password, Totp);
    obj = connect.GenerateToken();

                    AngelToken agr = obj.TokenResponse;
                    agr = obj.TokenResponse;
    
                    if (agr == null)
                    {
                        Console.WriteLine("Please check, Connection fail!");
                        //Console.ReadLine();
                        Thread.Sleep(1000);
                        continue;
                    }

  • @shivdasb1996
    Can someone share the updated method to use TOtp?
    GetTotp();
    //Login by client code and password
    obj = connect.GenerateSession(Client_code, Password, Totp);

    GenerateSession method accepts only 2 parameters. How to pass totp ?


  • @Vishal-naykawala Kindly put MPIN instead of Password.


  • I also got error today

    03-Jan-23 12:04:14 - Attempt#0 to initialize Angel SDK
    03-Jan-23 12:04:14 - Exception occured while Initializing Angel SDK
    Traceback (most recent call last):
      File "/home/a/Desktop/angel_st/src/angel_main.py", line 69, in init_angel_SDK
        refreshToken = data['data']['refreshToken']
    TypeError: 'NoneType' object is not subscriptable
    03-Jan-23 12:04:14 - Exception: 'NoneType' object is not subscriptable
    Traceback (most recent call last):
      File "/home/a/Desktop/angel_st/src/angel_main.py", line 69, in init_angel_SDK
        refreshToken = data['data']['refreshToken']
    TypeError: 'NoneType' object is not subscriptable
    

  • Please pass the MPIN in place of password


  • @Vishal-naykawala ,

    replace your password with MPIN.
    and try it will work