Skip to content

Commit 15db591

Browse files
committed
Fix/OpenSky: Response to wrong secret changed
1 parent d714141 commit 15db591

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

Src/LTOpenSky.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -265,19 +265,22 @@ bool OpenSkyConnection::ProcessFetchedData ()
265265
break;
266266

267267
// Unauthorized? Also wrong token, or wrong credentials when trying to get the token
268-
case HTTP_BAD_REQUEST: // OpenSky returns 400 in case of bad credentials when asking for the token...a bit weird, but so it is
269-
SHOW_MSG(logERR, "%s: Authorization failed! Verify Client Id/Secret in settings.",
270-
pszChName);
271-
SetValid(false,false);
272-
SetEnable(false); // also disable to directly allow user/pwd change...and won't work on retry anyway
273-
return false;
274-
268+
case HTTP_BAD_REQUEST: // OpenSky had returned 400 in case of bad credentials when asking for the token...seems it does no longer, but we handled it still
275269
case HTTP_UNAUTHORIZED: // OpenSky returns 401 in case of a bad or timed-out token
276-
LOG_MSG(logERR, "%s: Bad or timed-out access token",
277-
pszChName);
278-
ResetStatus(); // let's try with a new one
279-
IncErrCnt();
280-
return false;
270+
if (eState == OPSKY_STATE_GETTING_TOKEN) {
271+
SHOW_MSG(logERR, "%s: Authorization failed! Verify Client Id/Secret in settings.",
272+
pszChName);
273+
SetValid(false,false);
274+
SetEnable(false); // also disable to directly allow user/pwd change...and won't work on retry anyway
275+
return false;
276+
}
277+
else {
278+
LOG_MSG(logERR, "%s: Bad or timed-out access token",
279+
pszChName);
280+
ResetStatus(); // let's try with a new one
281+
IncErrCnt();
282+
return false;
283+
}
281284

282285
// Ran out of requests?
283286
case HTTP_TOO_MANY_REQU:

docs/readme.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ <h3>v4.2.1</h3>
153153
As a registered OpenSky user who wants to use up to 4000 request per day,
154154
you now need to optain a "Client ID" and "Client Secret" from
155155
<a href="https://opensky-network.org/my-opensky/account">your OpenSky account page</a>
156-
and enter those into LiveTraffic's settings.<br>
156+
and load or enter those into LiveTraffic's settings.<br>
157157
For more details <a href="https://twinfan.gitbook.io/livetraffic/setup/installation/opensky">see the documentation</a>.
158158
</li>
159159
<li>

0 commit comments

Comments
 (0)