BlazejosP / huawei-sun2000-API-CLI

Huawei SUN2000 compatible devices which working with Huawei Cloud Service command line bash API for monitoring or download data from their FusionSolarApp API
https://www.buymeacoffee.com/blazejosP
GNU General Public License v3.0
111 stars 15 forks source link

XSRF-TOKEN valid time #27

Closed mrks1337 closed 1 year ago

mrks1337 commented 2 years ago

Hi! How long is the XSRF-TOKEN token valid or how often does it has to be refreshed?

BlazejosP commented 2 years ago

Don't know exactly but that is around some hours from my own experience. If you look inside code you can found that XSRF-TOKEN is created when we log in with function

login_to_API inside file functions.sh and then is liquidated logout_from_API inside file functions.sh

I have feeling is I don't know why Huawei done this but logout is necessary probably because each XSRF-TOKEN take resources on their server and if you don't logout and you imagine that all devices calling their API by this software their webpage, mobile devices etc.. probably much RAM as is in modern servers may be not enough especially when not used XSRF-TOKEN take them even if is not used so my opinion is that probably live of token isn't long and that is why we created each time new when we login with this software and on the end logout function is called. There must be some technical reason why Huawei introduced logout to their API?