Penautan Akun

Setiap Action smart home harus menyertakan mekanisme untuk mengautentikasi pengguna.

Authentication memungkinkan Anda menautkan Akun Google pengguna dengan akun pengguna dalam sistem autentikasi Anda. Hal ini memungkinkan Anda mengidentifikasi pengguna saat fulfillment Anda menerima intent smart home. Smart home Google hanya mendukung OAuth dengan alur kode otorisasi.

Setelah menerapkan implementasi OAuth 2.0, Anda dapat mengonfigurasi App Flip berbasis OAuth secara opsional, yang memungkinkan pengguna menautkan akun mereka di sistem autentikasi ke Akun Google mereka dengan lebih cepat.

OAuth

Untuk smart home, Anda harus menggunakan OAuth dengan alur kode otorisasi, yang mengharuskan Anda memiliki dua endpoint: endpoint otorisasi dan pertukaran token.

Setelah Anda mengautentikasi pengguna, token akses OAuth 2.0 pihak ketiga pengguna akan dikirim di header otorisasi saat intent smart home dikirim ke fulfillment Anda. Semua pengguna harus melakukan penautan akun, karena informasi perangkat dikirim ke Google Assistant dengan intent action.devices.SYNC, yang memerlukan penautan akun.

Action smart home Anda diharapkan akan mendukung beberapa pengguna Google yang terhubung ke akun pengguna yang sama (misalnya, saat pengguna memberikan akses ke pengguna lain di rumah mereka). Jika layanan Anda tidak dapat mendukung beberapa koneksi pengguna, layanan tersebut akan menghasilkan error pada waktu penautan akun.

Guna mengetahui petunjuk cara menyiapkan server OAuth 2.0 untuk Action Anda, lihat Mengimplementasikan server OAuth 2.0.

App Flip berbasis OAuth

OAuth-based App Flip Linking (App Flip) allows your users to easily and quickly link their accounts in your authentication system to their Google accounts. If your app is installed on your user’s phone when they initiate the account linking process, they are seamlessly flipped to your app to obtain user authorization.

This approach provides a faster and easier linking process since the user does not have to re-enter their username and password to authenticate; instead, App Flip leverages the credentials from the user's account on your app. Once a user has linked their Google account with your app, they can take advantage of any integrations that you have developed.

You can set up App Flip for both iOS and Android apps.

This figure shows the steps for a user to link their Google account
            to your authentication system. The first screenshot shows how a user
            can select your app if their Google account is linked to your app.
            The second screenshot shows the confirmation for linking their
            Google account with your app. The third screenshot shows a
            successfully linked user account in the Google app.
Figure 1. Account linking on a user's phone with App Flip.

Requirements

To implement App Flip, you must fulfill the following requirements:

  • You must have an Android or iOS app.
  • You must own, manage and maintain an OAuth 2.0 server which supports the OAuth 2.0 authorization code flow.

Untuk informasi selengkapnya tentang alur kode otorisasi penautan OAuth, lihat Menerapkan server OAuth 2.0.

Untuk petunjuk cara mengonfigurasi App Flip untuk Action Anda, lihat App Flip berbasis OAuth.