You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: adminforth/documentation/docs/tutorial/07-Plugins/02-TwoFactorsAuth.md
+30-19Lines changed: 30 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -276,8 +276,8 @@ Add the new resource to index.ts:
276
276
277
277
resources: [
278
278
...
279
-
//diff-add
280
-
passkeysResource,
279
+
//diff-add
280
+
passkeysResource,
281
281
...
282
282
],
283
283
```
@@ -291,9 +291,6 @@ Now, update the settings of the Two-Factor Authentication plugin:
291
291
timeStepWindow: 1
292
292
//diff-add
293
293
passkeys: {
294
-
//diff-add
295
-
challengesKeyValueAdapter: newRAMKeyValueAdapter(), // you can use any key-value adapter
296
-
297
294
//diff-add
298
295
credentialResourceID: "passkeys",
299
296
//diff-add
@@ -305,20 +302,19 @@ Now, update the settings of the Two-Factor Authentication plugin:
305
302
//diff-add
306
303
settings: {
307
304
// diff-add
305
+
expectedOrigin: "http://localhost:3000", // important, set it to your backoffice origin (starts from scheme, no slash at the end)
306
+
//diff-add
308
307
// relying party config
309
308
//diff-add
310
-
rp: {
309
+
rp: {
310
+
//diff-add
311
+
name: "New Reality",
312
+
313
+
//diff-add
314
+
// optionaly you can set expected id explicitly if you need to:
315
+
//diff-add
316
+
// id: "localhost",
311
317
//diff-add
312
-
name: "New Reality",
313
-
// diff-add
314
-
// id should be a app domain name without port
315
-
// diff-add
316
-
// e.g. if you run locally in https://localhost:3500 -> then write "localhost"
317
-
// diff-add
318
-
// if you run at https://myadmin.myproduct.com -> write "myadmin.myproduct.com"
319
-
//diff-add
320
-
id: "localhost",
321
-
//diff-add
322
318
},
323
319
//diff-add
324
320
user: {
@@ -331,8 +327,16 @@ Now, update the settings of the Two-Factor Authentication plugin:
331
327
//diff-add
332
328
authenticatorSelection: {
333
329
// diff-add
334
-
// Can be "platform" or "cross-platform"
335
-
//diff-add
330
+
// impacts a way how passkey will be created
331
+
// diff-add
332
+
// - platform - using browser internal authenticator (e.g. Google Chrome passkey / Google Password Manager )
333
+
// diff-add
334
+
// - cross-platform - using external authenticator (e.g. Yubikey, Google Titan etc)
335
+
// diff-add
336
+
// - both - plging will show both options to the user
337
+
// diff-add
338
+
// Can be "platform", "cross-platform" or "both"
339
+
// diff-add
336
340
authenticatorAttachment: "platform",
337
341
//diff-add
338
342
requireResidentKey: true,
@@ -347,7 +351,14 @@ Now, update the settings of the Two-Factor Authentication plugin:
347
351
}),
348
352
],
349
353
```
350
-
> ☝️ most likely you should set `passkeys.settings.rp.id` it from your process.env depending on your env
354
+
355
+
> ☝️ most likely you should set `passkeys.settings.expectedOrigin` from your process.env depending on your env (e.g. http://localhost:3500 for local dev, https://admin.yourproduct.com for production etc)
356
+
357
+
358
+
> 💡**Note** By default `passkeys.settings.rp.id` is generated from the expectedOrigin so you don't need to set it
359
+
> unless you know what you are doing. Manual setting might be needed for sub-domains isolation.
360
+
> By default, if you set expected origin to https://localhost:3500 it will use "localhost" as rpid
361
+
> If you set origin to https://myadmin.myproduct.com -> it will use "myadmin.myproduct.com" as rpid
0 commit comments