พลิกแอป

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

Design guidelines

This section describes the design requirements and recommendations for the App Flip account linking consent screen. After Google calls your app, your app displays the consent screen to the user.

Requirements

  1. You must have a Google authorization statement such as "Once linked, Google will have permission to control your devices."
  2. You must communicate that the user's account is being linked to Google, not to a specific Google product, such as Google Home or Google Assistant.
  3. You must state a clear call-to-action on your consent screen and use the wording "Agree and link" for linking action. This is because users need to understand what data they're required to share with Google to link their accounts.
  4. You must provide a way for users to go back or cancel, if they choose not to link. Use the wording "Cancel" for the cancel action.
  5. You must implement this workflow: After clicking "Agree and link", you must show linking success and redirect the user back to the Google Home app automatically. The user should now see the linked device on the Google Home app with your action. After clicking "Cancel" you should redirect the user back to the Google Home app.

Recommendations

We recommend that you do the following:

  1. Display Google's Privacy Policy. Include a link to Google's Privacy Policy on the consent screen.

  2. Data to be shared. Use clear and concise language to tell the user what data of theirs Google requires and why.

  3. Ability to unlink. Offer a mechanism for users to unlink, such as a URL to their account settings on your platform. Alternatively, you can include a link to Google Account where users can manage their linked account.

  4. Ability to change user account. Suggest a method for users to switch their account(s). This is especially beneficial if users tend to have multiple accounts.

    • If a user must close the consent screen to switch accounts, send a recoverable error to Google so the user can sign in to the desired account with OAuth linking and the implicit flow.
  5. Include your logo. Display your company logo on the consent screen. Use your style guidelines to place your logo. If you wish to also display Google's logo, see Logos and trademarks.

This figure shows an example consent screen with call-outs to the
            individual requirements and recommendations to be followed when
            you design a user consent screen.
Figure 1: Account linking consent screen design guidelines.

ตั้งค่าApp Flipที่ใช้ OAuth

ส่วนต่อไปนี้จะอธิบายข้อกำหนดเบื้องต้นสำหรับ App Flip ที่ใช้ OAuth และวิธีกำหนดค่าโปรเจ็กต์ App Flip ในคอนโซลการดำเนินการ

สร้างการดำเนินการสำหรับสมาร์ทโฮมและตั้งค่าเซิร์ฟเวอร์ OAuth 2.0

ก่อนกำหนดค่า App Flip คุณต้องทำสิ่งต่อไปนี้

กำหนดค่า App Flip ในคอนโซล Actions

ส่วนต่อไปนี้อธิบายวิธีกำหนดค่า App Flip ในคอนโซลการดำเนินการ

  1. กรอกข้อมูลในช่องทั้งหมดในข้อมูลไคลเอ็นต์ OAuth (หากระบบไม่รองรับ App Flip ระบบจะใช้ OAuth ปกติเป็นโฆษณาสำรอง)
  2. ในส่วนใช้แอปเพื่อการลิงก์บัญชี(ไม่บังคับ) ให้เลือกเปิดใช้สำหรับ iOS
  3. กรอกข้อมูลในช่อง Universal Link ดูข้อมูลเพิ่มเติมเกี่ยวกับลิงก์สากลได้ที่การอนุญาตให้แอปและเว็บไซต์ลิงก์กับเนื้อหาของคุณ
  4. หากต้องการกำหนดค่าไคลเอ็นต์ ให้เพิ่มขอบเขตแล้วคลิกเพิ่มขอบเขตในส่วนกำหนดค่าไคลเอ็นต์ (ไม่บังคับ)
  5. คลิกบันทึก

ตอนนี้คุณไปที่ส่วนถัดไปเพื่อใช้งาน App Flip ในแอป iOS หรือ Android ได้แล้ว

นำ App Flip ไปใช้ในแอปที่มาพร้อมเครื่อง

หากต้องการใช้ App Flip คุณต้องแก้ไขรหัสการให้สิทธิ์ของผู้ใช้ในแอปเพื่อยอมรับ Deep Link จาก Google

ทดสอบ App Flip ในอุปกรณ์

เมื่อสร้างการดำเนินการและกำหนดค่า App Flip ในคอนโซลและในแอปแล้ว คุณสามารถทดสอบ App Flip ในอุปกรณ์เคลื่อนที่ได้ คุณสามารถใช้ Google Assistant app หรือ Google Home app (GHA) เพื่อทดสอบ App Flip

หากต้องการทดสอบ App Flip จาก Google Assistant app ให้ทำตามขั้นตอนต่อไปนี้

  1. ไปที่คอนโซล Actions แล้วเลือกโปรเจ็กต์
  2. คลิกทดสอบในการนําทางด้านบน
  3. ทริกเกอร์ขั้นตอนการลิงก์บัญชีจากแอป Google Assistant
    1. เปิด Google Assistant app
    2. คลิกการตั้งค่า
    3. ในแท็บ Assistant ให้คลิกระบบควบคุมอุปกรณ์ในบ้าน
    4. คลิกเพิ่ม(+)
    5. เลือกการดำเนินการจากรายชื่อผู้ให้บริการ ซึ่งจะมีคำนำหน้าด้วย "[test]" ในรายการ เมื่อเลือกการดำเนินการ [test] จากรายการ การดำเนินการควรเปิดแอปของคุณ
    6. ยืนยันว่าแอปเปิดใช้งานแล้วและเริ่มทดสอบขั้นตอนการให้สิทธิ์

หากต้องการทดสอบ App Flip จากแอป Google Home ให้ทำตามขั้นตอนต่อไปนี้

  1. ไปที่คอนโซล Actions แล้วเลือกโปรเจ็กต์
  2. คลิกทดสอบในการนําทางด้านบน
  3. ทริกเกอร์ขั้นตอนการลิงก์บัญชีจากแอป Home
    1. เปิด Google Home app (GHA)
    2. คลิกปุ่ม +
    3. คลิกตั้งค่าอุปกรณ์
    4. คลิกหากมีรายการที่ตั้งค่าแล้ว
    5. เลือกการดำเนินการ smart home จากรายการผู้ให้บริการ ซึ่งจะมีคำนำหน้าด้วย "[test]" ในรายการ เมื่อเลือกการดำเนินการ [test] จากรายการ การดำเนินการควรเปิดแอปของคุณ
    6. ยืนยันว่าแอปเปิดใช้งานแล้วและเริ่มทดสอบขั้นตอนการให้สิทธิ์