Skip to content

Commit af7ce06

Browse files
authored
Merge branch 'master' into brandon/BB2-3360-smart-on-fhir
2 parents c086578 + 2333f50 commit af7ce06

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

apps/docs/templates/oauth2-redirect.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<body>
99
<script>
1010
'use strict';
11+
const defaultPage = '/docs/openapi';
1112
function run () {
1213
function deserializeObject(serialized) {
1314
const parsedObj = JSON.parse(serialized);
@@ -23,6 +24,7 @@
2324
const code = urlParams.get('code');
2425
if (!code) {
2526
console.error('Authorization code not found in URL');
27+
window.location.href = defaultPage;
2628
return;
2729
}
2830

@@ -52,15 +54,16 @@
5254
})
5355
.then(response => {
5456
if (!response.ok) {
55-
throw new Error('Token request failed with status ' + response.status);
57+
console.log('Token request failed with status ' + response.status);
58+
window.location.href = defaultPage;
5659
}
5760
return response.json();
5861
})
5962
.then(data => {
6063
const accessToken = data.access_token;
6164
if (accessToken) {
6265
localStorage.setItem('access_token', accessToken);
63-
window.location.href = '/docs/openapi';
66+
window.location.href = defaultPage;
6467
}
6568
})
6669
.catch(error => {

0 commit comments

Comments
 (0)