Social Logins

Catalyst enables you to allow your end users to log on to your application using popular Identity Providers (IdP) or Social Logins through Authentication. Catalyst Android SDK enables you to provide Google login and logout functionality for your Android app users.

Note: Public Signup must be enabled to use Social Logins.

Google Login

You can provide a native Google login in your Android app by configuring their authentication with Catalyst. To do so, you must register your app in the Google API console and obtain the required OAuth credentials, that include the client ID and client secret.

You can learn about the steps involved in this process from the Enable Google Social Login help section.

Note: You must configure the application type as a web application in step 12.

After you finish configuring the Google social login in the Catalyst console, you can pass the client ID obtained from Google to perform the user login as shown below.

    
copy
fun login(activity: Activity, googleClientID: String, success: () -> Unit, failure: (ZCatalystException) -> Unit)

Parameters:

  • googleClientID: The client ID obtained after configuring OAuth in Google’s API console

A sample code snippet is shown below:

    
copy
ZCatalystApp.getInstance().login("activity", "570*******************", { success -> println("User login success") }, { exception -> println("User login failed $exception") })

Google Logout

You can log users out of your Catalyst Android app from their Google login by passing the client ID obtained from Google after configuring OAuth in Google’s API console. This can be done as shown below.

    
copy
fun logout(activity: Activity, googleClientID: String, success: () -> Unit, failure: (ZCatalystException) -> Unit)

Parameters:

  • googleClientID: The client ID obtained after configuring OAuth in Google’s API console

A sample code snippet is shown below:

    
copy
ZCatalystApp.getInstance().logout("activity", "570*******************", { println("Logout success") }, { println("Logout failed $exception") })

Last Updated 2023-09-03 01:06:41 +0530 +0530