Clear authentication cookies if login fails, due to revoked tokens
This commit is contained in:
parent
b2213751c3
commit
a4f8559108
1 changed files with 10 additions and 0 deletions
|
@ -135,6 +135,16 @@ export class OsmConnection {
|
||||||
}, function (err, details) {
|
}, function (err, details) {
|
||||||
if (err != null) {
|
if (err != null) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
if (err.status == 401) {
|
||||||
|
console.log("Clearing tokens...")
|
||||||
|
// Not authorized - our token probably got revoked
|
||||||
|
// Reset all the tokens
|
||||||
|
const tokens = [
|
||||||
|
"https://www.openstreetmap.orgoauth_request_token_secret",
|
||||||
|
"https://www.openstreetmap.orgoauth_token",
|
||||||
|
"https://www.openstreetmap.orgoauth_token_secret"]
|
||||||
|
tokens.forEach(token => localStorage.removeItem(token))
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue