Skip to content

Commit 98a58c7

Browse files
committed
Detect if user denied access in popup
1 parent d83736e commit 98a58c7

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

dist/osm-auth.cjs

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/osm-auth.cjs.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/osm-auth.iife.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/osm-auth.iife.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

land.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html><head></head>
33
<body>
44
<script>
5-
if (new URLSearchParams(location.search).has("code")) {
5+
if (new URLSearchParams(location.search).has("code") || new URLSearchParams(location.search).has("error")) {
66
new BroadcastChannel("osm-api-auth-complete").postMessage(location.href);
77
window.close();
88
}

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)