Create Google Registration and Login Example App with Code Generation

by on June 13, 2019

Register and Login with Google Code Generation App

Today we are going to walk you through the process of allowing users to register and log into your app using their Google account. The best way to showcase this is to walk through the Registration and Login example app available in the Code Generation section of your Backendless Console.

The first thing we’ll do is create an application with the name Registration_and_Login (you can choose any other name for the application, but then you will need to substitute it further everywhere).

Within Backendless

Go to the Code Generation section – select the category Android – Registration and Login.

Android Registration and Login Code Generation

In the window that appears, select only Google login – GENERATE.

Generate Google Registration and Login App

Copy the downloaded archive. Open the Archive in your favorite IDE; we will use IntelliJ IDEA.

Within Google API Console

Next, you need to click on this link and go to the Configure section of the Google API Console project. Click on the “CONFIGURE A PROJECT” button and enter the name of your project.

Configure Project in Google API Console

For this example, we chose the following name for the project: BackendlessRegistration. In the next step, we also use the name BackendlessRegistration.

Configure OAuth Client in Google API Console

In the next step, you need to select Android, enter the package name (which can be viewed in the manifest file of the downloaded project in src / main / AndroidManifest.xml). The creation of the SHA-1 signing certificate is described here. After entering all the necessary information, click CREATE.

Configure OAuth Client in Google API Console

Next, will be taken to the next screen, click on Download client configuration. The credentials.json file will be downloaded.

Download Client Credentials

The contents of the credentials.json file are as follows:


From this you need to take the values <client_id>, <project_id>, <client_secret> – open the google-services.json file in the downloaded project and replace its content with the following:

         "project_number": "1",
         "project_id": "<project_id>"
   "client": [
      "mobilesdk_app_id": "1:1:android:1556016075905",
      "package_name": "com.examples.registration_and_login.login"
            "client_id": "<client_id>",
            "client_type": 1,
            "android_info": {
            "package_name": "com.examples.registration_and_login.login",
            "certificate_hash": "<client_secret>"
      "api_key": [
            "current_key": "<client_secret>"
   "configuration_version": "1"

Then you need to go to values / strings.xml and replace two strings:

<string name = “gp_WebApp_ClientId”> </ string>
<string name = “gp_WebApp_ClientSecret”> </ string>


<string name = “gp_WebApp_ClientId”> <client_id> </ string>
<string name = “gp_WebApp_ClientSecret”> <client_secret> </ string>

Test Google Login

Now you can bring down the project and run it.

Login with Google App

Before you click the Login button, log in to your Google account on your phone. After logging into your Google account on your phone, return to the application and press the Login button. After a successful login, you will see the following screen:

Completed Login with Google Screen

That’s all, now your application’s Android users can log in using their Google account. Enjoy using Backendless services!

Leave a Reply