Skip to content

Commit cfec0ce

Browse files
docs: document POST options endpoints changes
1 parent 9c15fc3 commit cfec0ce

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Changed
6+
7+
- BREAKING!: The WebAuthn options endpoints (`passkey_registration_options`, `passkey_authentication_options`, `security_key_registration_options` and `security_key_authentication_options`) now respond to `POST` instead of `GET`, since they mutate server state (they store the WebAuthn challenge in the session). If you overrode any of these controllers, rename the overridden `index` action to `create`; if you copied the bundled JavaScript into your app, update your copy. [@santiagorodriguez96]
8+
59
## [v0.4.0](https://github.com/cedarcode/devise-webauthn/compare/v0.3.1...v0.4.0/) - 2026-04-06
610

711
### Added

‎README.md‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ Used for registering new credentials (passkeys or security keys).
283283
284284
```html
285285
<form action="/passkeys" method="post">
286-
<webauthn-create data-options-json="<%= create_passkey_options(@user).to_json %>">
286+
<webauthn-create data-options-url="<%= passkey_registration_options_path(:user) %>">
287287
<input type="hidden" name="public_key_credential" data-webauthn-target="response">
288288
<input type="text" name="name" placeholder="Passkey name">
289289
<button type="submit">Create Passkey</button>
@@ -296,17 +296,19 @@ Used for registering new credentials (passkeys or security keys).
296296
- The form's action should point to the appropriate endpoint – you can use the provided url helpers:
297297
- For creating passkeys: `passkeys_path(resource_name)`
298298
- For creating 2FA security keys: `second_factor_webauthn_credentials_path(resource_name)`
299-
- Requires a `data-options-json` attribute containing JSON-serialized WebAuthn creation options
299+
- Requires a `data-options-url` attribute pointing to the endpoint serving the WebAuthn creation options – you can use the provided url helpers:
300+
- For passkey creation options: `passkey_registration_options_path(resource_name)`
301+
- For 2FA security key creation options: `security_key_registration_options_path(resource_name)`
300302
- Must contain a hidden input with `data-webauthn-target="response"` to store the credential response
301-
- Must contain the submit button — the element intercepts form submission, calls the WebAuthn API, stores the credential in the hidden input, and then re-submits the form
303+
- Must contain the submit button – the element intercepts form submission, fetches the options, calls the WebAuthn API, stores the credential in the hidden input, and then re-submits the form
302304

303305
#### `<webauthn-get>`
304306

305307
Used for authenticating with existing credentials.
306308

307309
```html
308310
<form action="/users/sign_in" method="post">
309-
<webauthn-get data-options-json="<%= passkey_authentication_options.to_json %>">
311+
<webauthn-get data-options-url="<%= passkey_authentication_options_path(:user) %>">
310312
<input type="hidden" name="public_key_credential" data-webauthn-target="response">
311313
<button type="submit">Sign in with Passkey</button>
312314
</webauthn-get>
@@ -318,9 +320,11 @@ Used for authenticating with existing credentials.
318320
- The form's action should point to the appropriate endpoint – you can use the provided url helpers:
319321
- For passkey sign-in: `session_path(resource_name)`
320322
- For 2FA with WebAuthn: `two_factor_authentication_path(resource_name)`
321-
- Requires a `data-options-json` attribute containing JSON-serialized WebAuthn request options
323+
- Requires a `data-options-url` attribute pointing to the endpoint serving the WebAuthn request options – you can use the provided url helpers:
324+
- For passkey authentication options: `passkey_authentication_options_path(resource_name)`
325+
- For 2FA security key authentication options: `security_key_authentication_options_path(resource_name)`
322326
- Must contain a hidden input with `data-webauthn-target="response"` to store the credential response
323-
- Must contain the submit button — the element intercepts form submission, calls the WebAuthn API, stores the credential in the hidden input, and then re-submits the form
327+
- Must contain the submit button – the element intercepts form submission, fetches the options, calls the WebAuthn API, stores the credential in the hidden input, and then re-submits the form
324328
325329
## Development
326330

0 commit comments

Comments
 (0)