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
+29-17Lines changed: 29 additions & 17 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
```
@@ -302,22 +302,19 @@ Now, update the settings of the Two-Factor Authentication plugin:
302
302
//diff-add
303
303
settings: {
304
304
// diff-add
305
-
expectedOrigin: "http://localhost:3000",
305
+
expectedOrigin: "http://localhost:3000",// important, set it to your backoffice origin (starts from scheme, no slash at the end)
306
306
//diff-add
307
307
// relying party config
308
308
//diff-add
309
-
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",
310
317
//diff-add
311
-
name: "New Reality",
312
-
// diff-add
313
-
// id should be a app domain name without port
314
-
// diff-add
315
-
// e.g. if you run locally in https://localhost:3500 -> then write "localhost"
316
-
// diff-add
317
-
// if you run at https://myadmin.myproduct.com -> write "myadmin.myproduct.com"
318
-
//diff-add
319
-
id: "localhost",
320
-
//diff-add
321
318
},
322
319
//diff-add
323
320
user: {
@@ -330,8 +327,16 @@ Now, update the settings of the Two-Factor Authentication plugin:
330
327
//diff-add
331
328
authenticatorSelection: {
332
329
// diff-add
333
-
// Can be "platform", "cross-platform" or both
334
-
//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
335
340
authenticatorAttachment: "platform",
336
341
//diff-add
337
342
requireResidentKey: true,
@@ -346,7 +351,14 @@ Now, update the settings of the Two-Factor Authentication plugin:
346
351
}),
347
352
],
348
353
```
349
-
> ☝️ 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