Skip to content

Commit 04ae2ef

Browse files
committed
Adding passkey samples in the example.md file
1 parent 4304a05 commit 04ae2ef

File tree

1 file changed

+71
-1
lines changed

1 file changed

+71
-1
lines changed

EXAMPLES.md

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- [Usage](#usage)
2323
- [Requiring Authentication](#requiring-authentication)
2424
- [Handling Credentials Manager exceptions](#handling-credentials-manager-exceptions)
25+
- [Passkeys](#passkeys)
2526
- [Bot Protection](#bot-protection)
2627
- [Management API](#management-api)
2728
- [Link users](#link-users)
@@ -131,7 +132,7 @@ WebAuthProvider.logout(account)
131132
.start(this, logoutCallback)
132133
```
133134

134-
## Trusted Web Activity (Experimental)
135+
## Trusted Web Activity
135136
> **Warning**
136137
> Trusted Web Activity support in Auth0.Android is still experimental and can change in the future.
137138
>
@@ -607,6 +608,75 @@ when(credentialsManagerException) {
607608
}
608609
```
609610

611+
## Passkeys
612+
User should have a custom domain configured and passkey grant-type enabled in the Auth0 dashboard to use passkeys.
613+
614+
To sign up a user with passkey
615+
616+
```kotlin
617+
PasskeyAuthProvider.signUp(account)
618+
.setEmail("user email")
619+
.setUserName("user name")
620+
.setPhoneNumber("phone number")
621+
.setRealm("optional connection name")
622+
.start(object: Callback<Credentials, AuthenticationException> {
623+
override fun onFailure(exception: AuthenticationException) { }
624+
625+
override fun onSuccess(credentials: Credentials) { }
626+
})
627+
```
628+
<details>
629+
<summary>Using Java</summary>
630+
631+
```java
632+
PasskeyAuthProvider authProvider = new PasskeyAuthProvider();
633+
authProvider.signUp(account)
634+
.setEmail("user email")
635+
.setUserName("user name")
636+
.setPhoneNumber("phone number")
637+
.setRealm("optional connection name")
638+
.start(new Callback<Credentials, AuthenticationException>() {
639+
@Override
640+
public void onFailure(@NonNull AuthenticationException exception) { }
641+
642+
@Override
643+
public void onSuccess(@Nullable Credentials credentials) { }
644+
});
645+
```
646+
</details>
647+
648+
To sign in a user with passkey
649+
```kotlin
650+
PasskeyAuthProvider.signin(account)
651+
.setRealm("Optional connection name")
652+
.start(object: Callback<Credentials, AuthenticationException> {
653+
override fun onFailure(exception: AuthenticationException) { }
654+
655+
override fun onSuccess(credentials: Credentials) { }
656+
})
657+
```
658+
<details>
659+
<summary>Using Java</summary>
660+
661+
```java
662+
PasskeyAuthProvider authProvider = new PasskeyAuthProvider();
663+
authProvider.signin(account)
664+
.setRealm("optional connection name")
665+
.start(new Callback<Credentials, AuthenticationException>() {
666+
@Override
667+
public void onFailure(@NonNull AuthenticationException exception) { }
668+
669+
@Override
670+
public void onSuccess(@Nullable Credentials credentials) { }
671+
});
672+
```
673+
</details>
674+
675+
**Points to be Noted**:
676+
Passkeys are supported only on devices that run Android 9 (API level 28) or higher.
677+
To use passkeys ,user needs to add support for Digital Asset Links.
678+
679+
610680
## Bot Protection
611681
If you are using the [Bot Protection](https://auth0.com/docs/anomaly-detection/bot-protection) feature and performing database login/signup via the Authentication API, you need to handle the `AuthenticationException#isVerificationRequired()` error. It indicates that the request was flagged as suspicious and an additional verification step is necessary to log the user in. That verification step is web-based, so you need to use Universal Login to complete it.
612682

0 commit comments

Comments
 (0)