No CompletableFuture response on login

  • SDK Version: 5.3.1

  • Platform: Android

  • Browser Console Screenshots:

  • If the issue is related to Custom Authentication, please include the following information (optional):

    • Verifier Name:api-develop-myrenegade
    • JWKS Endpoint:https://api-develop.myrenegade.net/.well-known/jwks.json
    • Sample idToken (JWT):eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImE1YmJkZDNhMzBjOWJmODY2Njg0ZjY1MWJkIn0.eyJzdWIiOiJkMDUwYjUxMS0yMTRlLTQwZmEtODRhNy1lM2UyNDgzYWRiYjYiLCJuYW1lIjoiVGVzdCBUZXN0IiwiZW1haWwiOiJkYW5pbC5tYWthcmVua28yQGZsZXh5Y2hhaW4uY29tIiwiYXVkIjoiYW5kcm9pZDphcGsta2V5LWhhc2g6RHFqYmhfU1BqZG9TdjdlN0NaY2JqZm1ReS1hLVY4bkVRSDQ2WDhpRm94QSIsImlzcyI6Imh0dHBzOi8vYXBpLWRldmVsb3AubXlyZW5lZ2FkZS5uZXQiLCJpYXQiOjE3MDg1Mjc1MjgsImV4cCI6MTcwODUzMTEyOH0.h1_6TleXQBhd14v3-q47h5BylrJxYIw6SLDBkajD9fVDUlpihZNQDibWTcqtCVhVYJh7DflBfd-1h16Ndf3LuU3-Fv8J4wZypKY5gmFgRjge85yjnICQZTqS0hHXJBjr6WW83pSkARKQ0kYVCCwXwmIJQDm5u1sMBQu6UTFLVzizj34rnCg-9dopWZi_YQlPmuTLmPLLWw6NQrfJCSxqBNk6P0mtTxfC4zD7zrfr2Ag-FGOgtzGjAZGykflyRHwUpjn1BfbrwFeeJsRZOkP6ROD6KE99i7GcxZDtf1CCZ1jkRwt07c2OdSNt1gdBXsLSS00Mg8LjFhLl9i00xDA9SA

Init code

@Singleton
    @Provides
    fun provideWeb3Auth(
        @ApplicationContext context: Context
    ) = Web3Auth(
        Web3AuthOptions(
            context = context,
            clientId = context.getString(R.string.web3auth_project_id),
            network = Network.MAINNET,
            redirectUrl = Uri.parse ("${BuildConfig.APPLICATION_ID}://auth"),
            // Optional loginConfig object
            loginConfig = hashMapOf(
                "jwt" to LoginConfigItem(
                    verifier = "api-develop-myrenegade",
                    typeOfLogin = TypeOfLogin.JWT,
                    clientId = context.getString(R.string.web3auth_project_id)
                )
            )
        )
    )

Login code

private fun login() {
        viewModelScope.launch {
            withContext(Dispatchers.IO) {
                val token = repository.getWeb3AuthToken()
                val login = web3Auth.login(
                    LoginParams(
                        loginProvider = Provider.JWT,
                        extraLoginOptions = ExtraLoginOptions(
                            id_token = token,
                            domain = "https://api-develop.myrenegade.net",
                            verifierIdField = "sub"
                        )
                    )
                )
                val loginResponse = login.await()
            }
        }
    }

So the problem is the following: I don’t get any result from CompletableFuture
It just stucks without any error/result.

Additionally, I’m not sure your Android SDK docs are up to date.
For example, your documentation says redirectUrl is optional, but if I don’t pass it I’m getting the following exception
org.json.JSONException: No value for redirectUrl

Another example is here
Your LoginConfigItem class requires clientId, but it’s not totally clear from your documentation what should I pass here in case of custom jwt login, not Auth0

@danil.makarenko Your issue is under review and we will get back with further updates.

Hey, thanks for pointing out the doc issues, it helps us to improve the docs. Regarding the issue of login, can you confirm if you are calling setResultUrl in onNewIntent? Whenever user clicks on the login button, a new intent of CustomTabs is launched. It’s necessary step to use setResultUrl in onNewIntent

 override fun onNewIntent(intent: Intent?) {
        super.onNewIntent(intent)

        // Handle user signing in when app is active
        web3Auth.setResultUrl(intent?.data)
 }

Hey, Ayush!
Unfortunately, your suggestion didn’t help me, and the app still stucks on web3Auth.login(…).await()
Additionally, if this step is necessary, could you please update your documentation?

Could you please explain the idea behind using redirectUrl?
Why should CustomTabs be opened?

If you have any detailed & relevant documentation I’d really appreciate it.
Your current Android SDK documentation is saying about redirect_uri:

The default URL where Auth0 will redirect your browser to the authentication result.

But we are using Custom JWT Login and I’m not sure this description is relevant for our case.

Hey @danil.makarenko, can you share your repo? That would be helpful to identify the issue.

redirectUrl is used for the deep-linking purposes. The CustomTabs is launched for verification purposes. Even tho you are using the Custom JWT, the Web3Auth networks need to verify the JWT is valid for generation of private key or returning the private key if already exists. The redirectUrl is used to open the app again once the verification is successful on CustomTabs(which basically uses your default browser).

Can you also check you are doing the deep linking in your AndroidManifest file? You check the steps here: https://web3auth.io/docs/sdk/pnp/android/install#configure-deep-link

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.