Repository navigation
Commit e0b1eca
authored
feat: add passkey identifier verification with step-up pattern (#1299)
### Changes
Adds identifier verification (OTP) support to `useAuth0().passkey` for
passkey signup, using `@auth0/auth0-spa-js` v2.29.0.
- **Step-up flow:** when identifier verification is on for the
connection, `signup()` throws `PasskeyVerificationRequiredError` before
the passkey prompt. Its `verificationRequired` property lists the
identifiers to verify (for example `['email']`). Call the new
`passkey.continueSignup(codes)` to finish.
- **Wrong OTP:** `continueSignup()` throws a `PasskeyGetTokenError` with
`isRetryable: true`. Retrying reuses the same passkey, so the user
doesn't see a second biometric prompt.
- **State:** `continueSignup()` updates `isAuthenticated` and `user` in
the same way as `signup()` and `login()`. Errors are rethrown to the
caller.
- **Exports:** `PasskeyVerificationRequiredError`.
- **Dependency:** `@auth0/auth0-spa-js` goes from `^2.28.2` to
`^2.29.0`.
No breaking changes. `EXAMPLES.md` has a new Identifier Verification
section covering the flow, which errors can be retried, what happens on
a page reload, and the phone `deliveryMethod` option.
### References
- auth0/auth0-spa-js#1802
### Testing
Unit tests added in `__tests__/passkey.test.tsx`. Tested manually on a
test tenant with email and phone OTP: a wrong code, then the right code,
with `continueSignup()`.
- [x] This change adds unit test coverage
- [x] This change has been tested on the latest version of the
platform/language
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
- **New Features**
- Added support for continuing passkey signup after email or phone
verification, including submitting verification codes and selecting text
or voice delivery.
- Exported `PasskeyVerificationRequiredError` so apps can detect when
signup requires verification.
- Successful signup continuation updates authentication state, with
retry support for eligible errors.
- **Documentation**
- Expanded passkey examples with guidance on retryable errors, missing
codes, and restarting signup if the pending session ends.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent df2ad99 commit e0b1eca
8 files changed
Lines changed: 636 additions & 15 deletions
File tree
- __mocks__/@auth0
- __tests__
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1498 | 1498 | | |
1499 | 1499 | | |
1500 | 1500 | | |
| 1501 | + | |
1501 | 1502 | | |
1502 | 1503 | | |
1503 | 1504 | | |
| |||
1564 | 1565 | | |
1565 | 1566 | | |
1566 | 1567 | | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
1567 | 1659 | | |
1568 | 1660 | | |
1569 | 1661 | | |
1570 | | - | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
1571 | 1668 | | |
1572 | 1669 | | |
1573 | 1670 | | |
| |||
1577 | 1674 | | |
1578 | 1675 | | |
1579 | 1676 | | |
1580 | | - | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
1581 | 1681 | | |
1582 | 1682 | | |
1583 | 1683 | | |
| |||
1630 | 1730 | | |
1631 | 1731 | | |
1632 | 1732 | | |
| 1733 | + | |
| 1734 | + | |
1633 | 1735 | | |
1634 | 1736 | | |
1635 | 1737 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| 84 | + | |
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
| |||
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
| 122 | + | |
120 | 123 | | |
121 | 124 | | |
122 | 125 | | |
| |||
0 commit comments