การลิงก์บัญชี

การผสานรวมแบบ Cloud-to-cloud ทุกรายการต้องมีกลไกสำหรับการ ตรวจสอบสิทธิ์ผู้ใช้

การตรวจสอบสิทธิ์ช่วยให้คุณลิงก์บัญชี Google ของผู้ใช้ กับบัญชีผู้ใช้ในระบบการตรวจสอบสิทธิ์ได้ ซึ่งจะช่วยให้คุณระบุผู้ใช้ได้เมื่อ Fulfillment ได้รับ Intent ของสมาร์ทโฮม สมาร์ทโฮมของ Google รองรับเฉพาะ OAuth ที่มี ขั้นตอนรหัสการให้สิทธิ์เท่านั้น

เมื่อคุณใช้งาน OAuth 2.0 แล้ว คุณสามารถเลือกกำหนดค่า App Flip ที่อิงตาม OAuth App Flipซึ่งช่วยให้ ผู้ใช้ลิงก์บัญชีในระบบการตรวจสอบสิทธิ์ กับบัญชี Google ได้เร็วขึ้น

OAuth

สำหรับ smart home คุณต้องใช้ OAuth ที่มีขั้นตอนการใช้รหัสการให้สิทธิ์ ซึ่งกำหนดให้คุณต้องมีปลายทาง 2 รายการ ได้แก่ ปลายทาง การให้สิทธิ์ และ การแลกเปลี่ยนโทเค็น

เมื่อคุณตรวจสอบสิทธิ์ผู้ใช้แล้ว ระบบจะส่งโทเค็นเพื่อการเข้าถึง OAuth 2.0 ของบุคคลที่สามของผู้ใช้ในส่วนหัวของการให้สิทธิ์เมื่อส่งsmart home Intent ไปยังการดำเนินการตามคำขอ ผู้ใช้ทุกคนต้องทำการลิงก์บัญชี เนื่องจากระบบจะส่งข้อมูลอุปกรณ์ไปยัง Google Assistant ด้วย action.devices.SYNC Intent ซึ่งต้องมีการลิงก์บัญชี

ระบบคาดหวังให้การผสานรวมCloud-to-cloudรองรับผู้ใช้ Google หลายราย ที่เชื่อมต่อกับบัญชีผู้ใช้เดียวกัน (เช่น เมื่อผู้ใช้ให้สิทธิ์ เข้าถึงแก่ผู้ใช้รายอื่นในบ้าน) หากบริการของคุณไม่รองรับการเชื่อมต่อของผู้ใช้หลายคน บริการควรแสดงข้อผิดพลาดในเวลาที่ลิงก์บัญชี

ดูวิธีการตั้งค่าเซิร์ฟเวอร์ OAuth 2.0 สำหรับการผสานรวมได้ที่หัวข้อ การติดตั้งใช้งานเซิร์ฟเวอร์ OAuth 2.0

App Flip ที่อิงตาม 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.

ดูข้อมูลเพิ่มเติมเกี่ยวกับขั้นตอนรหัสการให้สิทธิ์สำหรับการลิงก์ OAuth ได้ที่ หัวข้อการติดตั้งใช้งานเซิร์ฟเวอร์ OAuth 2.0

ดูวิธีการกำหนดค่า App Flip สำหรับการผสานรวม ได้ที่หัวข้อ App Flip ที่อิงตาม OAuth App Flip