0

From Google Code Labs there is an Android project written in Kotlin. When I run this project, I can run the passkey authentication demo, but it does not actually access the authentication server. If there is an actual authentication server, how do I add code to connect to the authentication server? I have checked the reference site, but do not know how to communicate with the authentication server.

・Codelab https://codelabs.developers.google.com/credential-manager-api-for-android#0

・Android Project https://github.com/android/identity-samples/tree/credman_codelab

・Reference URL https://developer.android.com/training/sign-in/passkeys?hl=ja#kotlin


My code:

SignUpFragment.kt
private fun signUpWithPasskeys(): View.OnClickListener {

    data?.let {
        // (mock) Returns true indicating that the server has saved the public key for future use.
        registerResponse()
        // flag to true to indicate that you are logging in using the passkey.
        DataProvider.setSignedInThroughPasskeys(true)
        // Once logged in, redirect the user to the home screen.
        listener.showHome()
    }
}


private fun registerResponse(): Boolean {
    // Do you want to add the source code for the connection to the server here?
    return true
}



SignInFragment.kt
private fun signInWithSavedCredentials(): View.OnClickListener {

    data?.let {
        //(mock) Returns true indicating that the server has validated the public key for future use.
        sendSignInResponseToServer()
        // Once logged in, redirect the user to the home screen.
        listener.showHome()
    }
}

private fun sendSignInResponseToServer(): Boolean {
    //Do you want to add the source code for the connection to the server here?
    return true
}
Hironori
  • 1
  • 2

0 Answers0