แนวทางปฏิบัติแนะนำสำหรับความเป็นส่วนตัวและความปลอดภัย
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ต่อไปนี้เป็นหลักเกณฑ์ด้านความปลอดภัยและความเป็นส่วนตัวสำหรับนักพัฒนาซอฟต์แวร์ที่ใช้ Google Assistant API ในโครงการของตน
การให้สิทธิ์ API และแอปพลิเคชัน
แอปพลิเคชันที่ใช้ Google Assistant API ต้องมีข้อมูลเข้าสู่ระบบการให้สิทธิ์ที่ระบุแอปพลิเคชันกับเซิร์ฟเวอร์การตรวจสอบสิทธิ์ของ Google
โดยปกติแล้ว ข้อมูลเข้าสู่ระบบเหล่านี้จะจัดเก็บไว้ในไฟล์ client_secret_<client-id>.json
ที่ดาวน์โหลดมา โปรดเก็บไฟล์นี้ในตำแหน่งที่แอปพลิเคชันของคุณสามารถเข้าถึงได้เท่านั้น
แอปพลิเคชันของคุณอาจแจ้งให้ผู้ใช้ให้สิทธิ์เข้าถึงบัญชี Google ของตน
หากได้รับอนุญาต แอปพลิเคชันของคุณจะขอโทเค็นเพื่อการเข้าถึงของผู้ใช้รายนั้นได้ โทเค็นเหล่านี้จะหมดอายุ แต่สามารถรีเฟรชได้
โทเค็นการรีเฟรชที่ไม่มีการป้องกันในอุปกรณ์อาจมีความเสี่ยงด้านความปลอดภัยอย่างมาก ตรวจสอบว่าแอปพลิเคชัน
- จัดเก็บโทเค็นการรีเฟรชไว้ในที่ปลอดภัย
- มอบวิธีง่ายๆ ในการล้างโทเค็นออกจากอุปกรณ์ เช่น มอบปุ่ม "ออกจากระบบ" ที่ล้างโทเค็น (หากแอปพลิเคชันมี UI) หรือสคริปต์บรรทัดคำสั่งที่ผู้ใช้เรียกใช้ได้
- แจ้งให้ผู้ใช้ทราบว่าสามารถยกเลิกการให้สิทธิ์เข้าถึงบัญชี Google ของตน การดำเนินการนี้จะเพิกถอนโทเค็นการรีเฟรช หากต้องการใช้แอปพลิเคชันอีกครั้ง ผู้ใช้จะต้องให้สิทธิ์การเข้าถึงอีกครั้ง
เมื่อคุณใช้อุปกรณ์อย่างถาวรเสร็จแล้ว คุณควรล้างโทเค็นทั้งหมดออกจากอุปกรณ์นั้น
สำหรับข้อมูลเพิ่มเติม โปรดดูที่การใช้ OAuth 2.0 เพื่อเข้าถึง Google API
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eApplications using the Google Assistant API require authorization credentials, typically stored in a \u003ccode\u003eclient_secret_<client-id>.json\u003c/code\u003e file, which should be kept secure.\u003c/p\u003e\n"],["\u003cp\u003eUser granted access allows applications to request access tokens that expire but can be refreshed; however, unprotected refresh tokens pose a security risk and should be stored securely with options for users to clear them.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers should inform users about the ability to deauthorize access to their Google account through Google's permissions page, which revokes the refresh token and requires re-authorization for further application use.\u003c/p\u003e\n"]]],["Applications using the Google Assistant API require authorization credentials, typically stored in a `client_secret` file, which should be securely stored. Applications may obtain user-specific access tokens, which can be refreshed. Refresh tokens must be securely stored, and applications should allow users to clear them, such as through a \"Sign out\" feature or a command line. Users should be informed that they can deauthorize application access, and all tokens should be cleared when a device is no longer used.\n"],null,["# Best Practices for Privacy and Security\n\nHere are some security and privacy guidelines for developers using the Google\nAssistant API in their projects.\n\nAPI and application authorization\n---------------------------------\n\nAny application that uses the Google Assistant API must have authorization\ncredentials that identify the application to Google's authentication server.\nTypically, these credentials are stored in a downloaded `client_secret_\u003cclient-id\u003e.json`\nfile. Make sure to store this file in a location that only your application\ncan access.\n\nYour application may prompt the user to grant it access to their Google account.\nIf granted, your application can request an access token for that user. These\ntokens expire, but can be refreshed.\n\nUnprotected refresh tokens on a device pose a significant security risk. Make\nsure your application:\n\n- Stores the refresh tokens in a secure place.\n- Provides an easy way to clear tokens from the device. For example, provide a \"Sign out\" button that clears a token (if the application has a UI) or a command line script that the user can execute.\n- Informs users that they can [deauthorize access](https://myaccount.google.com/permissions) to their Google account. This revokes the refresh token; to use the application again, the user would need to re-authorize access.\n\nWhen you are done using the device permanently, you should clear all of the\ntokens from it.\n\nFor more information, see [Using OAuth 2.0 to Access Google APIs](https://developers.google.com/identity/protocols/OAuth2)."]]