ghostjat / Shoonya-php

Using Finvasia Shoonya api for NSE, BSE, NFO trading using php
MIT License
5 stars 7 forks source link

Fatal error: Uncaught RuntimeException: Unable to decode the secret. Is it correctly base32 encoded #1

Closed himanshu208 closed 1 year ago

himanshu208 commented 1 year ago

Hi I am getting this error

Fatal error: Uncaught RuntimeException: Unable to decode the secret. Is it correctly base32 encoded? in E:\1xampp\htdocs\Shoonya-php-main\vendor\spomky-labs\otphp\src\OTP.php:130 Stack trace: #0 E:\1xampp\htdocs\Shoonya-php-main\vendor\spomky-labs\otphp\src\OTP.php(60): OTPHP\OTP->getDecodedSecret() #1 E:\1xampp\htdocs\Shoonya-php-main\vendor\spomky-labs\otphp\src\TOTP.php(76): OTPHP\OTP->generateOTP(56026463) #2 E:\1xampp\htdocs\Shoonya-php-main\vendor\spomky-labs\otphp\src\TOTP.php(81): OTPHP\TOTP->at(1680793892) #3 E:\1xampp\htdocs\Shoonya-php-main\src\Core\Shoonya.php(93): OTPHP\TOTP->now() #4 E:\1xampp\htdocs\Shoonya-php-main\index.php(9): Core\Shoonya->login() #5 {main} thrown in E:\1xampp\htdocs\Shoonya-php-main\vendor\spomky-labs\otphp\src\OTP.php on line 130

Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: POST https://api.shoonya.com/NorenWClientTP/Logout resulted in a 400 Bad Request response: {"stat":"Not_Ok","emsg":"Invalid Input : uid is not in string format"} in E:\1xampp\htdocs\Shoonya-php-main\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php:113 Stack trace: #0 E:\1xampp\htdocs\Shoonya-php-main\vendor\guzzlehttp\guzzle\src\Middleware.php(69): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response), NULL, Array, NULL) #1 E:\1xampp\htdocs\Shoonya-php-main\vendor\guzzlehttp\promises\src\Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response)) #2 E:\1xampp\htdocs\Shoonya-php-main\vendor\guzzlehttp\promises\src\Promise.php(153): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), NULL) #3 E:\1xampp\htdocs\Shoonya-php-main\vendor\guzzlehttp\promises\src\TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}() #4 E:\1xampp\htdocs\Shoonya-php-main\vendor\guzzlehttp\promises\src\Promise.php(248): GuzzleHttp\Promise\TaskQueue->run(true) #5 E:\1xampp\htdocs\Shoonya-php-main\vendor\guzzlehttp\promises\src\Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn() #6 E:\1xampp\htdocs\Shoonya-php-main\vendor\guzzlehttp\promises\src\Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending() #7 E:\1xampp\htdocs\Shoonya-php-main\vendor\guzzlehttp\promises\src\Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList() #8 E:\1xampp\htdocs\Shoonya-php-main\vendor\guzzlehttp\promises\src\Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending() #9 E:\1xampp\htdocs\Shoonya-php-main\vendor\guzzlehttp\guzzle\src\Client.php(187): GuzzleHttp\Promise\Promise->wait() #10 E:\1xampp\htdocs\Shoonya-php-main\vendor\guzzlehttp\guzzle\src\ClientTrait.php(95): GuzzleHttp\Client->request('POST', 'https://api.sho...', Array) #11 E:\1xampp\htdocs\Shoonya-php-main\src\Core\Shoonya.php(1006): GuzzleHttp\Client->post('https://api.sho...', Array) #12 E:\1xampp\htdocs\Shoonya-php-main\src\Core\Shoonya.php(999): Core\Shoonya->post('/Logout', 'jData={"orderso...') #13 E:\1xampp\htdocs\Shoonya-php-main\src\Core\Shoonya.php(107): Core\Shoonya->request('logout', Array) #14 E:\1xampp\htdocs\Shoonya-php-main\src\Core\Shoonya.php(1037): Core\Shoonya->logout() #15 [internal function]: Core\Shoonya->__destruct() #16 {main} thrown in E:\1xampp\htdocs\Shoonya-php-main\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 113

ghostjat commented 1 year ago

Hi himanshu, Unable to decode the secret key for totp. Is it correctly base32 encoded. "56026463" Your secret key for totp must be of base64 encoded. If it is possible for you to share your source code, i can go further for debug.