بعد إعداد عملية تنفيذ OAuth 2.0، يمكنك اختياريًا ضبط ميزة "التبديل إلى التطبيق" المستندة إلى OAuth App Flip، ما يسمح لمستخدمي 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
- You must have a Google authorization statement such as "Once linked, Google will have permission to control your devices."
- 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.
- 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.
- You must provide a way for users to go back, deny or cancel, if they choose not to link. Use the wording "Cancel" for the cancel action.
- 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:
Display Google's Privacy Policy. Include a link to Google's Privacy Policy on the consent screen.
Data to be shared. Use clear and concise language to tell the user what data of theirs Google requires and why.
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.
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.
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.
إعداد ميزة App Flip المستندة إلى OAuth
توضّح الأقسام التالية المتطلبات الأساسية لميزة "التبديل إلى التطبيق" المستندة إلى OAuth وكيفية ضبط مشروع "التبديل إلى التطبيق" في Google Home Developer Console.
إنشاء عملية دمج من السحابة الإلكترونية إلى السحابة الإلكترونية وإعداد خادم OAuth 2.0
قبل أن تتمكّن من ضبط App Flip، عليك تنفيذ ما يلي:
- إعداد خادم OAuth 2.0 : لمزيد من المعلومات حول إعداد خادم OAuth ، يُرجى الاطّلاع على مقالة تنفيذ خادم OAuth 2.0.
- إنشاء عملية دمج من السحابة الإلكترونية إلى السحابة الإلكترونية : لإنشاء عملية دمج، اتّبِع التعليمات الواردة في مقالة إنشاء عملية دمج من السحابة الإلكترونية إلى السحابة الإلكترونية.
ضبط ميزة "التبديل إلى التطبيق" في Developer Console
يوضّح القسم التالي كيفية ضبط ميزة "التبديل إلى التطبيق" في Developer Console.
- املأ جميع الحقول ضمن معلومات عميل OAuth. (إذا لم تكن ميزة App Flip متاحة، يتم استخدام بروتوكول OAuth العادي كحل بديل).
- ضمن استخدام تطبيقك لربط الحساب(اختياري)، ضَع علامة في المربّع تفعيل لنظام التشغيل iOS.
- املأ حقل الرابط العام. لمزيد من المعلومات عن الروابط العامة، يُرجى الاطّلاع على مقالة السماح للتطبيقات والمواقع الإلكترونية بالربط بمحتواك.
- إذا أردت ضبط عميلك بشكل اختياري، أضِف النطاقات وانقر على إضافة نطاق ضمن ضبط عميلك (اختياري).
- انقر على حفظ.
يمكنك الآن الانتقال إلى القسم التالي لتنفيذ App Flip في تطبيق iOS أو Android.
تنفيذ App Flip في تطبيقاتك الأصلية
لتنفيذ App Flip، عليك تعديل رمز تفويض المستخدم في تطبيقك لقبول رابط لصفحة معيّنة من Google.
اختبار App Flip على جهازك
بعد إنشاء عملية دمج من السحابة الإلكترونية إلى السحابة الإلكترونية وضبط ميزة "التبديل إلى التطبيق" على وحدة التحكّم و في تطبيقك، يمكنك اختبار ميزة "التبديل إلى التطبيق" على جهازك الجوّال. يمكنك استخدام تطبيق Google Home لاختبار ميزة "التبديل إلى التطبيق" .
لاختبار App Flip من تطبيق Google Home، اتّبِع الخطوات التالية:
- انتقِل إلى Developer Console واختَر مشروعك.
- انتقِل إلى من السحابة الإلكترونية إلى السحابة الإلكترونية > اختبار.
- ابدأ مسار ربط الحساب من تطبيق Home:
- افتح الـ Google Home app (GHA).
- انقر على الزر +.
- انقر على إعداد جهاز.
- انقر على هل لديك أجهزة سبق وتمّ إعدادها؟
- اختَر عملية الدمج من السحابة الإلكترونية إلى السحابة الإلكترونية من قائمة مقدّمي الخدمات. ستسبقها العبارة " " "[اختبار]" في القائمة. عند اختيار عملية الدمج [اختبار] من القائمة، من المفترض أن يتم فتح تطبيقك.
- تأكَّد من تشغيل تطبيقك وابدأ اختبار مسار التفويض.