Demonstration of fido module functionality of yubikit-android
in an Android app with a web-view, as told by the workshopslides here: https://bit.ly/yubifest24slides.
On startup the app will open https://passkey.org, where the users can create a passkey on a Security key, or authenticate with a passkey on a Security key. Use the text field to enter different URL, or the shortcuts (passkey.org, webauthn.io, Fido2 demo) to quickly open sites used during development.
The clear cookies button will remove all cookies from the web view.
- Run the application, passkey.org will open in the web view.
- Scroll down until you see the Demo/Try it out section.
- Enter a random username, click Sign up and Continue.
- The application opens dialog with Create credential title.
- Either connect your YubiKey to the USB port, or tap the phone with your NFC YubiKey.
- If the YubiKey has a FIDO2 PIN, the app will ask for it - enter the PIN and tap again with the NFC YubiKey. If there is no PIN configured, some sites will refuse to create credential.
- Now the credential is created and passkey.org should show "Welcome" screen.
- It is now possible to go to
passkey.org
on a desktop computer and sign in with the created credential.
- Create a credential on a YubiKey for
passkey.org
. - Run the application.
- Click the
passkey.org
button and alsoClear cookies
button. - Scroll down to the Demo/Try it out section.
- Click the Sign in with passkey button.
- The application opens dialog with Get credential title.
- Either connect your YubiKey to the USB port, or tap the phone with your NFC YubiKey.
- If the YubiKey has a FIDO2 PIN, the app will ask for it - enter the PIN and tap again with the NFC YubiKey. If there is no PIN configured, some sites will refuse to create credential.
- If there were several credentials for
passkey.org
on the YubiKey, a selection window will appear. Choose one by tapping on it. - The web view shows "Welcome" screen.
The application also supports Credential manager. Currently, to access this functionality, there must be no USB key connected to the phone.
To use Credential Manager, follow the Create/Sign in steps and when the Create credential or Get credential dialog is shown, click the OTHER OPTIONS button to start Credential Manager FIDO2 flows.
To remove the button from the dialog, change the value of USE_CREDENTIAL_MANAGER
in
YubiKitWebauthnHelper.kt
to false.
More information about Credential Manager can be found at https://developer.android.com/identity/sign-in/credential-manager.
- access to https://github.com/YubicoLabs/fido2-webview-yubikit-workshop.git (this repository)
- Android development setup
- ANDROID_SDK environmental variable
- Android SDK installed
- or: Android Studio installed
- Internet connection (for getting dependencies)
- Android phone
- create working directory and checkout sources
git clone https://github.com/YubicoLabs/fido2-webview-yubikit-workshop.git cd yubikit_fido_demo
- build fido2-webview-yubikit-workshop
cd fido2-webview-yubikit-workshop echo "sdk.dir=$ANDROID_SDK" > local.properties ./gradlew assembleDebug
- Install and run
adb install -r
the apk into connected android device and run- The apk is present in
./app/build/outputs/apk/debug/app-debug.apk
.
- Use Android Studio
- The app was developed in Android Studio and it should be possible to just import the project and run it from there.