Skip to content

Commit f0e66ea

Browse files
committed
Merge branch 'deny-access' of github.com:ENT8R/osm-auth into ENT8R-deny-access
2 parents c4526a0 + 98a58c7 commit f0e66ea

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

docs/land.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
<head></head>
44
<body>
55
<script>
6-
if (new URLSearchParams(location.search).has("code")) {
6+
var params = new URLSearchParams(location.search);
7+
if (params.has("code") || params.has("error")) {
78
new BroadcastChannel("osm-api-auth-complete").postMessage(location.href);
89
window.close();
910
}

src/osm-auth.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,11 @@ export function osmAuth(o) {
253253
error.status = 'invalid-state';
254254
callback(error);
255255
return;
256+
} else if (params.error !== undefined) {
257+
var err = new Error(params.error_description.replace(/\+/g, ' '));
258+
err.status = params.error;
259+
callback(err);
260+
return;
256261
}
257262
_getAccessToken(params.code, pkce.code_verifier, accessTokenDone);
258263
bc.close();

0 commit comments

Comments
 (0)