Loxone / lxcommunicator

Communicate securily with the Loxone Miniserver via Websocket or HTTP requests
MIT License
63 stars 20 forks source link

Error at refreshing Token #10

Closed nightfreak closed 4 years ago

nightfreak commented 4 years ago

I am using lxcommunicator without any changes. After 1 day running fine I always get the following error:

TokenHandler    TokenCommand failed! jdev/sys/refreshjwt/%s/%s
Could not refresh the token of 'chris' with permission + UNDEFINED, APP, OP_MODES, AUTOPILOT, EXPERT_MODE_LIGHT
{"LL":{"control":"dev/sys/refreshjwt","value":"File not found!","Code":"404"}}
Invalid/Outdated token - kill it!
2002
TokenHandler    TokenCommand failed! jdev/sys/killtoken/%s/%s

My Miniserver version is 9.1.10.30

idoodler commented 4 years ago

@nightfreak Hi, it looks like there is an issue with Miniservers running below 10.1.12.11 which is the version JWT were introduced.

Please try to replace the function '_getRefreshCommand' in 'TokenHandlerExt' with the following:

_getRefreshCommand: function _getRefreshCommand() {
    return FeatureCheck.check(FeatureCheck.feature.JWT_SUPPORT) ? Commands.TOKEN.REFRESH_JWT : Commands.TOKEN.REFRESH;
}

Quick explanation: The commands are currently reversed, so if JWT is supported the non JWT command is used and vice versa.

idoodler commented 4 years ago

@nightfreak Please checkout the development branch, it includes a fix

It is handled in PR #12

idoodler commented 4 years ago

@nightfreak ping

nightfreak commented 4 years ago

Thanks, its solved!