Google Signin Using CustomTabIntent In Android Kotlin

43 Views Asked by At

`

class AuthWebActivity : AppCompatActivity() {

private lateinit var binding: ActivityAuthWebBinding
private lateinit var customTabsIntent: CustomTabsIntent

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    binding = DataBindingUtil.setContentView(this@AuthWebActivity, R.layout.activity_auth_web)

    binding.apply {
        val url = "https://bloodbond.net/api/Account/ExternalLogin?provider=Google&response_type=token&client_id=self&redirect_uri=https%3A%2F%2Fbloodbond.net%2FHome%2FLogin"

        // Create a custom tab intent builder
        val customTabsIntentBuilder = CustomTabsIntent.Builder()
            .setColorScheme(CustomTabsIntent.COLOR_SCHEME_LIGHT)
            .addDefaultShareMenuItem()
            .enableUrlBarHiding()

        // Build and launch the custom tab
        customTabsIntent = customTabsIntentBuilder.build()

        tvSiwg.setOnClickListener {
            customTabsIntent.launchUrl(this@AuthWebActivity, Uri.parse(url))
        }
    }
}

},`

This Is My Custom Tab Intent Code, I Want Signin Using Googel, When I Will Launch This Url, It will show google accounts list in inbuilt app browser, when i will select the account irt will give session data how can i get it, using callbacks or anyother option to doing this, please help me to out.

0

There are 0 best solutions below