Commit 6274a9f6 authored by Michael Tross's avatar Michael Tross

fix expires_in parameter parsing

parent dbeac73a
......@@ -323,11 +323,11 @@ netatmo_get_token()
netatmo.refresh_token = strdup(json_object_get_string(val));
configChanged = true;
}
} else if (!strcmp(key, "expire_in")) {
} else if (!strcmp(key, "expires_in")) {
if (type == json_type_int) {
int exp = json_object_get_int(val);
g_access_token_valid_until = time(NULL) + exp - 120; // 2 minutes before expiration
vdc_report(LOG_INFO, "network: token expire_in: %d -> valid until %ld\n", exp, g_access_token_valid_until);
vdc_report(LOG_INFO, "network: token expires_in: %d -> valid until %ld\n", exp, g_access_token_valid_until);
}
} else if (!strcmp(key, "scope")) {
// ignore
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment