OpenApi-5p / 5paisa-java

11 stars 13 forks source link

Cookie Not found with LoginRequestV2 and LoginRequestV4 #1

Open pavandv16 opened 3 years ago

pavandv16 commented 3 years ago

Url >> https://Openapi.5paisa.com/VendorsAPI/Service1.svc/V4/LoginRequestMobileNewbyEmail

Request >> {"head":{"password":"xxxxx","appVer":"1.0","appName":"xxxxxxx","requestCode":"5PLoginV4","osName":"WEB","userId":"xxxxx","key":"xxxxxxxxx"},"body":{"HDSerialNumber":"","MachineID":"xxxx","MACAddress":"Xxxxxx","ConnectionType":1,"PublicIP":"192.168.29.255","LocalIP":"192.168.29.187","Email_id":"oWsJ\/xxxxxxxxx=","My2PIN":"xxxxxxxx+C4hAQ==","VersionNo":"1.7","RequestNo":1,"Password":"xxxxxxx\/t1Q=="}}

Cookies name:::null Exception in thread "main" java.lang.NullPointerException at java.io.Writer.write(Writer.java:157) at com.FivePaisa.service.ApiCalls.writeFile(ApiCalls.java:202) at com.FivePaisa.service.ApiCalls.apiCall(ApiCalls.java:147) at com.FivePaisa.service.ApiCalls.callLogin(ApiCalls.java:108) at com.FivePaisa.api.RestClient.LoginRequestV4(RestClient.java:53) at MyTest.LoginRequestV2(MyTest.java:52) at MyTest.main(MyTest.java:70)

Process finished with exit code 1

pavandv16 commented 3 years ago

Identified the root cause and fixed the issue AES.encrypt(data) is using the hardcoded encryption key by creating a new AppConfig object

Resolution: We should either use the encryption key from AppConfig object by passing an additional parameter or Need to configure the encrypted credentials in Property.java and remove the three AES.encript(propertries.password) from callLogin(-,-,-,-) of APICalls.java

I will push the changeset, please review and include the change in the next version

Thanks, Pavan