Configure Google Sign-In

Last Updated on : 2024-06-24 05:41:01download

The OEM apps that are created on the Tuya Developer Platform use new settings starting from v3.19. This allows users to use the Google Sign-In feature as expected. If your app version is earlier than v3.19, update the version on the Tuya Developer Platform and follow the steps in this topic to configure the Google Sign-In feature.

Prerequisites

You already have a Google account. Otherwise, you can log in to the Google Cloud Platform, and follow the instructions on the platform to create a Google account. This account is required for login to your app.

Create an app

  1. Log in to the Google Cloud Platform.

  2. In the top menu bar, click Select a Project > NEW PROJECT to create a project.

    Configure Google Sign-In

  3. Enter the app information and click CREATE.

    Configure Google Sign-In

Configure OAuth consent screen

If the OAuth 2.0 authentication protocol is used, your app requests permissions for access to one or more domains with a Google account. For this purpose, Google shows users a consent screen, including the project information, policies, and requested domains. Perform the following steps:

  1. Go to OAuth consent screen.

  2. Set User Type to External.

    Configure Google Sign-In

  3. Configure information that appears on the OAuth consent screen:

    • App information:

      Configure Google Sign-In

    • App domain:

      Configure Google Sign-In

Add app platforms

Android

  1. Click Credentials > + CREATE CREDENTIALS.

    Configure Google Sign-In

  2. Select OAuth client ID from the drop-down list.

    Configure Google Sign-In

  3. Create the OAuth client ID for Android.

    Configure Google Sign-In

    • Package Name: the name of your app package. It must be the same as the package name that is used for the app on the Tuya Developer Platform.

      Configure Google Sign-In

    • SHA-1: the SHA1 value of your app. It must be the same as the SHA1 value that is used for the app on the Tuya Developer Platform.

      Configure Google Sign-In

  4. Create the OAuth client ID of web application type.

    Configure Google Sign-In

  5. Copy and paste the OAuth client ID to the Tuya Developer Platform.

    1. Copy the value in the Client ID column.

      Configure Google Sign-In

    2. Go to Tuya Developer Platform > App > OEM App > Optional Setting, click Third-Party Integration tab, scroll down to the Login Configuration for Android section, and then paste the client ID to Client ID for Google.

      Configure Google Sign-In

iOS

  1. Click Credentials > + CREATE CREDENTIALS.

    Configure Google Sign-In

  2. Select OAuth client ID from the drop-down list.

    Configure Google Sign-In

  3. Create the OAuth client ID for iOS.

    Configure Google Sign-In

    Bundle ID: the Bundle ID of your app. It must be the same as the Bundle ID that is used for the app on the Tuya Developer Platform.

    Configure Google Sign-In

  4. Copy and paste the OAuth client ID to the Tuya Developer Platform.

    1. Copy the value in the Client ID column.

      Configure Google Sign-In

    2. Go to Tuya Developer Platform > App > OEM App > Optional Setting, click Third-Party Integration tab, scroll down to the Login Configuration for iOS section, and then paste the client ID to Client ID for Google.

      Configure Google Sign-In