File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -33,12 +33,13 @@ document.addEventListener(
33
33
errorElement . innerText = "" ;
34
34
beginElement . disabled = true ;
35
35
36
- // GET registration options from the endpoint that calls
37
- // @simplewebauthn /server -> generateRegistrationOptions()
38
- const authOptions = await fetch ( authOptionsUrl ) ;
39
-
40
36
let asseResp ;
37
+
41
38
try {
39
+ // GET registration options from the endpoint that calls
40
+ // @simplewebauthn /server -> generateRegistrationOptions()
41
+ const authOptions = await fetch ( authOptionsUrl ) ;
42
+
42
43
// Pass the options to the authenticator and wait for a response
43
44
asseResp = await startAuthentication ( await authOptions . json ( ) ) ;
44
45
} catch ( error ) {
@@ -66,8 +67,9 @@ document.addEventListener(
66
67
const hasNotification = urlParams . get ( "notification" ) !== null ;
67
68
68
69
if ( ! hasNotification ) {
69
- const authOptions = await fetch ( authOptionsUrl ) ;
70
70
try {
71
+ const authOptions = await fetch ( authOptionsUrl ) ;
72
+
71
73
let asseResp = await startAuthentication (
72
74
await authOptions . json ( ) ,
73
75
true ,
@@ -78,6 +80,7 @@ document.addEventListener(
78
80
authenticationResponseForm . requestSubmit ( ) ;
79
81
} catch ( e ) {
80
82
// fail silently
83
+ console . error ( e ) ;
81
84
}
82
85
}
83
86
} ;
Original file line number Diff line number Diff line change @@ -32,12 +32,13 @@ document.addEventListener(
32
32
clearDisplay ( ) ;
33
33
beginElement . disabled = true ;
34
34
35
- // GET registration options from the endpoint that calls
36
- // @simplewebauthn /server -> generateRegistrationOptions()
37
- const resp = await fetch ( "/api/webauthn/generate-registration-options" ) ;
38
-
39
35
let attResp ;
36
+
40
37
try {
38
+ // GET registration options from the endpoint that calls
39
+ // @simplewebauthn /server -> generateRegistrationOptions()
40
+ const resp = await fetch ( "/api/webauthn/generate-registration-options" ) ;
41
+
41
42
// Pass the options to the authenticator and wait for a response
42
43
attResp = await startRegistration ( await resp . json ( ) ) ;
43
44
} catch ( error ) {
You can’t perform that action at this time.
0 commit comments