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: v3/docs/authentication/webauthn/customise-credential-validation.mdx
+28-18Lines changed: 28 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -12,17 +12,21 @@ The WebAuthN flow allows the user to customise the way credentials are generated
12
12
13
13
For example, in the case of a banking app, the user may want to use a YubiKey to generate and validate credentials. In this case, the user may want to use a required PIN or a biometric factor to validate the credential.
14
14
15
-
TODO: Add correct link
16
-
Most of the customisation is done through function overrides. You can find more details about how they work here: [Overrides](https://deploy-preview-869--starlit-elf-06ee1a.netlify.app/docs/references/sdks/functions-overrides/backend-functions-override).
15
+
Most of the customisation is done through function overrides. You can find more details about how they work here: [Overrides](/docs/references/sdks/functions-overrides/backend-functions-override).
17
16
18
17
## Recipe Configuration
19
18
20
-
TODO: Add correct link
21
-
The recipe configuration is done by the `init` function. You can find more details about the recipe configuration here: [Recipe Configuration](#).
19
+
The recipe configuration is done by the `init` function. You can find more details about the recipe configuration here: [Recipe Configuration](https://supertokens.com/docs/nodejs/modules/recipe_webauthn.html#init).
22
20
23
21
When configuring the recipe, you can pass the following options:
24
-
-**Relying Party**: Details about the entity for which the credential is being generated. This includes the domain name (Relying Party ID) and display name (Relying Party Name) of your application that will be shown to the user during authentication. The Relying Party ID defaults to the API domain (`apiBasePath`) and the Relying Parth Name defaults to the application name (`appName`).
25
-
-**Origin**: The origin URL that the credential is generated on. Defaults to the origin of the request.
22
+
23
+
| Option | Key Name | Description | Default Value |
| Relying Party ID |`getRelyingPartyId`| The domain name of your application that will be shown to the user during authentication | API domain (`apiBasePath`) |
26
+
| Relying Party Name |`getRelyingPartyName`| The display name of your application that will be shown to the user during authentication | Application name (`appName`) |
27
+
| Origin |`getOrigin`| The origin URL that the credential is generated on | Origin of the request |
28
+
29
+
All of the above options are optional and if not provided, the recipe will use the default values. For more details on the default values, please refer to the [Recipe Configuration](https://supertokens.com/docs/nodejs/modules/recipe_webauthn.html#init) documentation.
26
30
27
31
```ts
28
32
importsupertokensfrom"supertokens-node";
@@ -69,14 +73,17 @@ The credential is generated based on a set of options that you can pass to the `
69
73
70
74
The possible configurable options are:
71
75
72
-
-**Relying Party**: Details about the entity for which the credential is being generated. This includes the domain name (Relying Party ID) and display name (Relying Party Name) of your application that will be shown to the user during authentication. The Relying Party ID defaults to the API domain (`apiBasePath`) and the Relying Parth Name defaults to the application name (`appName`).
73
-
-**Origin**: The origin URL that the credential is generated on. Defaults to the origin of the request.
74
-
-**Timeout**: The time in milliseconds that the user has to complete the credential generation process. Defaults to `6000`.
75
-
-**Attestation**: Controls how much information about the authenticator is included in the attestation statement. This controls what authenticators are supported. Defaults to `none`.
76
-
-**Supported Algorithms**: The cryptographic algorithms that can be used for generating credentials. Different authenticators support different algorithms. Defaults to `[-8, -7, -257]`.
77
-
-**Resident Key**: Whether the credential should be stored on the authenticator device. Defaults to `required`.
78
-
-**User Verification**: Controls whether user verification (like PIN or biometrics) is required. Defaults to `preferred`.
79
-
-**User Display Name**: The display name of the user. Defaults to the `email` field.
76
+
| Option | Key Name | Description | Default Value |
| Relying Party ID |`relyingPartyId`| The domain name of your application that will be shown to the user during authentication. | API domain (`apiBasePath`) |
79
+
| Relying Party Name |`relyingPartyName`| The display name of your application that will be shown to the user during authentication. | Application name (`appName`) |
80
+
| Origin |`origin`| The origin URL that the credential is generated on. | Origin of the request |
81
+
| Timeout |`timeout`| The time in milliseconds that the user has to complete the credential generation process. |`6000`|
82
+
| Attestation |`attestation`| Controls how much information about the authenticator is included in the attestation statement. This controls what authenticators are supported. |`none`|
83
+
| Supported Algorithms |`supportedAlgorithms`| The cryptographic algorithms that can be used for generating credentials. Different authenticators support different algorithms. |`[-8, -7, -257]`|
84
+
| Resident Key |`residentKey`| Whether the credential should be stored on the authenticator device. |`required`|
85
+
| User Verification |`userVerification`| Controls whether user verification (like PIN or biometrics) is required. |`preferred`|
86
+
| User Display Name |`displayName`| The display name of the user. |`email` field |
80
87
81
88
Below is an example of how you can customise the credential generation options.
82
89
@@ -133,10 +140,13 @@ supertokens.init({
133
140
134
141
When a user attempts to login using a WebAuthN credential, the credential is used for signing a challenge through the client using `navigator.credentials.get` function. The options for signing the challenge are generated on the server through the SDK and defined how the authentication will take place:
135
142
136
-
-**Relying Party ID**: The domain name (Relying Party ID) of your application that will be used for validating the credential.
137
-
-**Origin**: The origin URL that the credential is generated on. Defaults to the origin of the request.
138
-
-**Timeout**: The time in milliseconds that the user has to complete the credential validation process. Defaults to `6000`.
139
-
-**User Verification**: Controls whether user verification (like PIN or biometrics) is required. Defaults to `preferred`.
143
+
| Option | Key Name | Description | Default |
144
+
|--------|----------|-------------|---------|
145
+
|**Relying Party ID**|`relyingPartyId`| The domain name of your application that will be used for validating the credential. | - |
146
+
|**Relying Party Name**|`relyingPartyName`| The human-readable name of your application. | - |
147
+
|**Origin**|`origin`| The origin URL that the credential is generated on. | Origin of the request |
148
+
|**Timeout**|`timeout`| The time in milliseconds that the user has to complete the credential validation process. |`6000`|
149
+
|**User Verification**|`userVerification`| Controls whether user verification (like PIN or biometrics) is required. |`preferred`|
140
150
141
151
Below is an example of how you can customise the credential generation options.
@@ -14,8 +28,9 @@ This page will show you how to add the WebAuthn recipe to your project. The tuto
14
28
15
29
## Before you start
16
30
17
-
-- important note --
18
-
These intructions assume that you already have gone through our main quickstart guide. If you have skipped that page please follow the tutorial and return here once you're done.
31
+
:::info Note
32
+
These instructions assume that you already have gone through our main quickstart guide. If you have skipped that page please follow the tutorial and return here once you're done.
33
+
:::
19
34
20
35
21
36
## Steps
@@ -24,22 +39,122 @@ These intructions assume that you already have gone through our main quickstart
24
39
25
40
<UIType.PrebuiltUIContent>
26
41
27
-
prebuilt
28
42
43
+
### 1. Initialize the Frontend SDK
44
+
45
+
<FrontendPrebuiltUITabsshowMobileTab>
46
+
<FrontendPrebuiltUITabs.TabItemvalue="reactjs">
47
+
#### 1.1 Add the `Webauthn` recipe in your main configuration file.
#### 1.1 Add the `Webauthn` recipe in your main configuration file.
35
150
36
151
Call the SDK init function at the start of your application. The invocation includes the main configuration details, as well as the recipes that you will be using in your setup.
The following section will demonstrate you what aspects you need to cover in order to implement the UI for the WebAuthN flow.
60
-
61
-
62
-
#### 2.1 Add the Signup Form
172
+
#### 1.2 Add the Signup Form
63
173
64
174
You will have to first add the UI elements which will render your form. When the users submits the form you will have to call the following API to create the credential and send it to the backend in order to create the user and store the credential.
65
175
@@ -111,7 +221,7 @@ async function signUp(email: string) {
111
221
}
112
222
```
113
223
114
-
#### 2.2 Add the Login Form
224
+
#### 1.3 Add the Login Form
115
225
116
226
You will have to first add the UI elements which will render your form. When the users submits the form you will have to call the following API to use the credential and send the response to the backend in order to login the user.
117
227
@@ -155,12 +265,13 @@ async function signIn(email: string) {
155
265
}
156
266
}
157
267
```
268
+
</UIType.CustomUIContent>
158
269
159
-
### 3. Initialize the Backend SDK
270
+
### 2. Initialize the Backend SDK
160
271
161
272
You will have to intialize the Backend SDK alongside the code that starts your server. The init call will include configuration details for your app, how the backend will connect to the SuperTokens Core, as well as the Recipes that will be used in your setup.
162
273
163
-
For the WebAuthN recipe, you can also specify the following optional parameters:
274
+
For the WebAuthN recipe, you can also specify the following optional parameters:
164
275
-`emailDelivery`: Configure how verification emails are sent to users. You can use the default email service or integrate your own email delivery provider.
165
276
166
277
-`getRelyingPartyId`: Set the domain name that will be associated with the WebAuthn credentials (e.g. "example.com"). This helps ensure credentials can only be used on your domain. It defaults to the origin domain.
@@ -195,22 +306,12 @@ supertokens.init({
195
306
websiteBasePath: "/auth",
196
307
},
197
308
recipeList: [
198
-
WebAuthN.init({
199
-
getRelyingPartyId: () => {
200
-
return'<YOUR_API_DOMAIN>';
201
-
},
202
-
getRelyingPartyName: () => {
203
-
return'<YOUR_APP_NAME>';
204
-
},
205
-
}),
206
-
Session.init()
309
+
WebAuthN.init(),
310
+
Session.init()
207
311
]
208
312
});
209
313
```
210
314
211
-
</UIType.CustomUIContent>
212
-
213
-
214
315
## Next Steps
215
316
216
317
Now that you have completed the main setup you can explore more advanced topics related to the WebAuthN recipe.
Copy file name to clipboardExpand all lines: v3/docs/authentication/webauthn/introduction.mdx
+3-10Lines changed: 3 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -31,16 +31,8 @@ Key aspects of passkeys include:
31
31
32
32
-**Platform Integration**: Passkeys are deeply integrated into operating systems and browsers, providing a seamless experience across different platforms and devices
33
33
34
-
-**Enhanced Security**:
35
-
- End-to-end encryption during syncing
36
-
- Phishing-resistant by design
37
-
- Based on public key cryptography
38
-
- Protected by biometric authentication or device PIN
39
-
40
34
-**Improved User Experience**:
41
-
- No passwords to remember
42
35
- Automatic syncing between devices
43
-
- Quick and easy authentication using biometrics
44
36
- Familiar system UI for authentication
45
37
46
38
While passkeys and WebAuthn credentials share the same underlying technology, passkeys add the convenience of cross-device availability while maintaining the strong security guarantees of WebAuthn.
@@ -51,7 +43,9 @@ Before diving into WebAuthn implementation, it's important to understand the key
51
43
52
44
For a more detailed explanation of the WebAuthn specification, you can refer to the [WebAuthn specification](https://www.w3.org/TR/webauthn/).
53
45
54
-
Note: Throughout our documentation, the terms "passkey" and "credential" are used interchangeably, though they have subtle technical differences explained below.
46
+
:::info Note
47
+
Throughout our documentation, the terms "passkey" and "credential" are used interchangeably, though they have subtle technical differences explained below.
48
+
:::
55
49
56
50
-**Passkey**: A user-friendly term for WebAuthn credentials that are synced across a user's devices. Passkeys are:
57
51
- More convenient than traditional credentials as they sync automatically
@@ -89,7 +83,6 @@ Note: Throughout our documentation, the terms "passkey" and "credential" are use
89
83
90
84
The WebAuthn feature in SuperTokens provides:
91
85
92
-
- Complete implementation of the WebAuthn standard
93
86
- Support for platform authenticators (biometric sensors) and roaming authenticators (security keys)
94
87
- Automatic handling of device registration and authentication
0 commit comments