This section provides detailed steps for integrating Google and Facebook login functionality into your application using the Google SDK and Facebook SDK. This guide will walk you through the process of incorporating authentication via Google and Facebook, enabling users to seamlessly log in using their existing accounts. The integration covers both the setup of the respective SDKs and the necessary configuration steps for a smooth login experience.

Prerequisites

  1. Before you proceed with integrating Google and Facebook login using the Google SDK and Facebook SDK, make sure to complete the integration steps from the OTPless Android Headless SDK Documentation.

  2. Add SDK dependencies:

Build.gradle
dependencies {
    // For facebook login sdk:
    implementation("io.github.otpless-tech:fusionfacebook:latest_version")
    // For google login sdk: 
    implementation("io.github.otpless-tech:fusiongoogle:latest_version")
}

Once you’ve completed the integration from the link above, you can continue with the following steps to incorporate Google and Facebook login into your app.

Please check the latest version of the Google SDK here and Facebook SDK here. Make sure to synchronize your Gradle project to fetch the dependency.

Choose your platform type to initiate login:

Request

To initiate an google login, set the channel type as GOOGLE_SDK.

final OtplessRequest googleSdkRequest = new OtplessRequest();
googleSdkRequest.setChannelType(OtplessChannelType.GOOGLE_SDK);
OtplessSDK.INSTANCE.startAsync(googleSdkRequest, this::onOtplessResponse);

Note: Provide Google Client ID

For proper functioning of Google login in your application, you need to provide the ClientId and Client Secret of the credentials created on the Google Cloud Console.

Please ensure that the ClientId and Client Secret associated with your application is provided to OTPless for seamless integration and authentication functionality. This is crucial for the authentication process to work correctly.