@@ -210,20 +210,10 @@ const authenticate = async (
210
210
autoSelectionIdentity : autoSelectionIdentity ,
211
211
} ) ;
212
212
213
- // Here, if the user is returning & doesn't have any recovery device, we prompt them to add
214
- // one. The exact flow depends on the device they use.
215
- // XXX: Must happen before auth protocol is done, otherwise the authenticating dapp
216
- // may have already closed the II window
217
- if ( ! authSuccess . newAnchor ) {
218
- await recoveryWizard ( authSuccess . userNumber , authSuccess . connection ) ;
219
- }
220
-
221
213
// at this point, derivationOrigin is either validated or undefined
222
214
const derivationOrigin =
223
215
authContext . authRequest . derivationOrigin ?? authContext . requestOrigin ;
224
216
225
- // Ignore the response of committing the metadata because it's not crucial.
226
- void authSuccess . connection . commitMetadata ( ) ;
227
217
const result = await withLoader ( ( ) =>
228
218
fetchDelegation ( {
229
219
connection : authSuccess . connection ,
@@ -240,6 +230,17 @@ const authenticate = async (
240
230
} ;
241
231
}
242
232
233
+ // Here, if the user is returning & doesn't have any recovery device, we prompt them to add
234
+ // one. The exact flow depends on the device they use.
235
+ // XXX: Must happen before auth protocol is done, otherwise the authenticating dapp
236
+ // may have already closed the II window
237
+ if ( ! authSuccess . newAnchor ) {
238
+ await recoveryWizard ( authSuccess . userNumber , authSuccess . connection ) ;
239
+ }
240
+
241
+ // Ignore the response of committing the metadata because it's not crucial.
242
+ void authSuccess . connection . commitMetadata ( ) ;
243
+
243
244
const [ userKey , parsed_signed_delegation ] = result ;
244
245
245
246
const userPublicKey = Uint8Array . from ( userKey ) ;
0 commit comments