Skip to content

Conversation

@pmathew92
Copy link
Contributor

This PR adds examples for passkey enrollment

@pmathew92 pmathew92 requested a review from a team as a code owner June 4, 2025 10:26
EXAMPLES.md Outdated
Use the Auth0 My Account API to manage the current user's account.

To call the My Account API, you need an access token issued specifically for this API, including any required scopes for the operations you want to perform.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this, you'd also need to add docs about getting said access token. E.g. https://github.com/auth0/Auth0.swift/blob/master/EXAMPLES.md#api-credentials-ea

Otherwise, devs could assume you have to use the audience slot (on the initial login) for that, which is not possible if they're already using their own audience value. This is precisely the problem that MRRT solves.

EXAMPLES.md Outdated
val client = MyAccountAPIClient(account, accessToken)

client.passkeyEnrollmentChallenge()
.start(object :Callback<PasskeyEnrollmentChallenge,MyAccountException>{
Copy link
Contributor

@Widcket Widcket Jun 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.start(object :Callback<PasskeyEnrollmentChallenge,MyAccountException>{
.start(object: Callback<PasskeyEnrollmentChallenge, MyAccountException> {

EXAMPLES.md Outdated
Comment on lines 702 to 710
val client = MyAccountAPIClient(account, "accessToken")

try{
val challenge = client.passkeyEnrollmentChallenge()
.await()
println("Challenge: $challenge")
} catch (exception:MyAccountException){
print("Error: ${exception.message}")
}
Copy link
Contributor

@Widcket Widcket Jun 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val client = MyAccountAPIClient(account, "accessToken")
try{
val challenge = client.passkeyEnrollmentChallenge()
.await()
println("Challenge: $challenge")
} catch (exception:MyAccountException){
print("Error: ${exception.message}")
}
val client = MyAccountAPIClient(account, "accessToken")
try {
val challenge = client.passkeyEnrollmentChallenge()
.await()
println("Challenge: $challenge")
} catch (exception: MyAccountException) {
print("Error: ${exception.message}")
}

Comment on lines 737 to 746
client.enroll(passkeyCredential,challenge)
.start(object :Callback<PasskeyAuthenticationMethod,MyAccountException>{
override fun onSuccess(result: PasskeyAuthenticationMethod) {
println("Passkey enrolled successfully: ${result.id}")
}

override fun onFailure(error: MyAccountException) {
println("Error enrolling passkey: ${error.message}")
}
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
client.enroll(passkeyCredential,challenge)
.start(object :Callback<PasskeyAuthenticationMethod,MyAccountException>{
override fun onSuccess(result: PasskeyAuthenticationMethod) {
println("Passkey enrolled successfully: ${result.id}")
}
override fun onFailure(error: MyAccountException) {
println("Error enrolling passkey: ${error.message}")
}
})
client.enroll(passkeyCredential, challenge)
.start(object: Callback<PasskeyAuthenticationMethod,MyAccountException> {
override fun onSuccess(result: PasskeyAuthenticationMethod) {
println("Passkey enrolled successfully: ${result.id}")
}
override fun onFailure(error: MyAccountException) {
println("Error enrolling passkey: ${error.message}")
}
})

EXAMPLES.md Outdated
Comment on lines 753 to 759
try{
val result = client.enroll(passkeyCredential,challenge)
.await()
println("Passkey enrolled successfully: ${result.id}")
}catch(error:MyAccountException){
println("Error enrolling passkey: ${error.message}")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
try{
val result = client.enroll(passkeyCredential,challenge)
.await()
println("Passkey enrolled successfully: ${result.id}")
}catch(error:MyAccountException){
println("Error enrolling passkey: ${error.message}")
}
try {
val result = client.enroll(passkeyCredential, challenge)
.await()
println("Passkey enrolled successfully: ${result.id}")
} catch(error: MyAccountException){
println("Error enrolling passkey: ${error.message}")
}

@pmathew92 pmathew92 merged commit fb06876 into main Jun 9, 2025
7 checks passed
@pmathew92 pmathew92 deleted the example/passkey branch June 9, 2025 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants