Skip to content

Commit 73d12ef

Browse files
committed
2fa docs fixes
1 parent cbe6e55 commit 73d12ef

File tree

1 file changed

+29
-17
lines changed

1 file changed

+29
-17
lines changed

adminforth/documentation/docs/tutorial/07-Plugins/02-TwoFactorsAuth.md

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ Add the new resource to index.ts:
276276

277277
resources: [
278278
...
279-
//diff-add
280-
passkeysResource,
279+
//diff-add
280+
passkeysResource,
281281
...
282282
],
283283
```
@@ -302,22 +302,19 @@ Now, update the settings of the Two-Factor Authentication plugin:
302302
//diff-add
303303
settings: {
304304
// 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)
306306
//diff-add
307307
// relying party config
308308
//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",
310317
//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
321318
},
322319
//diff-add
323320
user: {
@@ -330,8 +327,16 @@ Now, update the settings of the Two-Factor Authentication plugin:
330327
//diff-add
331328
authenticatorSelection: {
332329
// 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
335340
authenticatorAttachment: "platform",
336341
//diff-add
337342
requireResidentKey: true,
@@ -346,7 +351,14 @@ Now, update the settings of the Two-Factor Authentication plugin:
346351
}),
347352
],
348353
```
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
350362
351363
The setup is complete. To create a passkey:
352364

0 commit comments

Comments
 (0)