تلنگر برنامه

هنگامی که یک OAuth 2.0 پیاده سازی کردید، می توانید به صورت اختیاری App Flip مبتنی بر OAuth را پیکربندی کنید، که به کاربران Android شما امکان می دهد سریعتر حساب های خود را در سیستم احراز هویت شما به حساب های Google خود پیوند دهند. بخش‌های زیر نحوه طراحی و پیاده‌سازی App Flip برای ادغام Cloud-to-cloud توضیح می‌دهند.

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 خود را در Google Home Developer Console شرح می‌دهند.

یک ادغام Cloud-to-Cloud ایجاد کنید و یک سرور OAuth 2.0 راه اندازی کنید

قبل از اینکه بتوانید App Flip پیکربندی کنید، باید موارد زیر را انجام دهید:

App Flip را در Developer Console پیکربندی کنید

بخش زیر نحوه پیکربندی App Flip را در Developer Console توضیح می‌دهد.

  1. تمام فیلدهای زیر اطلاعات مشتری OAuth را پر کنید. (اگر App Flip پشتیبانی نمی شود، OAuth معمولی به عنوان یک بازگشت استفاده می شود.)
  2. در قسمت Use your app for account linking (اختیاری) ، گزینه Enable for iOS را علامت بزنید.
  3. فیلد پیوند جهانی را پر کنید. برای اطلاعات بیشتر درباره پیوندهای جهانی، به اجازه دادن به برنامه‌ها و وب‌سایت‌ها برای پیوند دادن به محتوای شما مراجعه کنید.
  4. اگر می‌خواهید به صورت اختیاری مشتری خود را پیکربندی کنید، دامنه‌ها را اضافه کنید و روی Add scope در زیر Configure your client (اختیاری) کلیک کنید.
  5. روی ذخیره کلیک کنید.

اکنون می توانید برای پیاده سازی App Flip در برنامه iOS یا Android خود به بخش بعدی بروید.

App Flip در برنامه های بومی خود پیاده کنید

برای اجرای App Flip ، باید کد مجوز کاربر را در برنامه خود تغییر دهید تا پیوند عمیق از Google را بپذیرید.

App Flip روی دستگاه خود تست کنید

اکنون که یک ادغام Cloud-to-Cloud ایجاد کرده اید و App Flip را در کنسول و برنامه خود پیکربندی کرده اید، می توانید App Flip را در دستگاه تلفن همراه خود آزمایش کنید. می‌توانید از برنامه Google Home برای آزمایش App Flip استفاده کنید.

برای آزمایش App Flip از برنامه Google Home ، این مراحل را دنبال کنید:

  1. به Developer Console بروید و پروژه خود را انتخاب کنید.
  2. به Cloud-to-cloud > Test بروید.
  3. جریان پیوند حساب را از برنامه Home فعال کنید:
    1. Google Home app (GHA) را باز کنید.
    2. روی دکمه + کلیک کنید.
    3. روی تنظیم دستگاه کلیک کنید.
    4. روی آیا چیزی قبلاً تنظیم شده است؟
    5. ادغام Cloud-to-Cloud خود را از لیست ارائه دهندگان انتخاب کنید. پیشوند آن با "[test]" در لیست خواهد بود. وقتی ادغام [تست] خود را از لیست انتخاب می کنید، باید برنامه شما را باز کند.
    6. بررسی کنید که برنامه شما راه اندازی شده است و شروع به آزمایش جریان مجوز خود کنید.