โทเค็นเพื่อการเข้าถึงแบบจำกัด
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
โทเค็นเพื่อการเข้าถึงแบบจํากัดจะช่วยป้องกันการปลอมแปลงคําขอและการโจมตีแบบเล่นซ้ําเพื่อให้มั่นใจว่าจะมีการดําเนินการโดยผู้ใช้เมื่อมีการส่งข้อความ คุณจะได้รับการป้องกันโดยการเพิ่มพารามิเตอร์โทเค็นที่ไม่ซ้ํากันลงในพารามิเตอร์คําขอและยืนยันเมื่อมีการเรียกใช้การทํางาน
คุณควรสร้างพารามิเตอร์โทเค็นเป็นคีย์ที่ใช้ได้เฉพาะกับการกระทําบางอย่างและผู้ใช้บางรายเท่านั้น ก่อนดําเนินการตามที่ขอ คุณควรตรวจสอบว่าโทเค็นถูกต้องและตรงกับโทเค็นที่คุณสร้างขึ้นสําหรับผู้ใช้ หากโทเค็นตรงกัน ก็จะดําเนินการและโทเค็นไม่ถูกต้องสําหรับคําขอในอนาคต
ควรส่งโทเค็นเพื่อการเข้าถึงให้กับผู้ใช้ที่เป็นส่วนหนึ่งของพร็อพเพอร์ตี้ url
ของ HttpActionHandler เช่น หากแอปพลิเคชันจัดการคําขออนุมัติที่ http://www.example.com/approve?requestId=123
คุณควรพิจารณารวมพารามิเตอร์ accessToken
เพิ่มเติมไว้ในรายการและฟังคําขอที่ส่งไปยัง http://www.example.com/approve?requestId=123&accessToken=xyz
ชุดค่าผสม requestId=123
และ accessToken=xyz
คือชุดค่าผสมที่คุณจําเป็นต้องสร้างล่วงหน้า โปรดตรวจสอบให้แน่ใจว่าไม่สามารถอนุมาน accessToken
จาก requestId
ได้ คําขออนุมัติที่มี requestId=123
ไม่มี accessToken
หรือที่มี accessToken
ไม่เท่ากับ xyz
ควรถูกปฏิเสธ เมื่อดําเนินการตามคําขอแล้ว ระบบจะปฏิเสธคําขอในอนาคตที่มีรหัสและโทเค็นการเข้าถึงเดียวกันด้วย
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[],[],null,["# Limited Use Access Tokens\n\nLimited-Use Access Tokens provide protection from request spoofing and [replay attacks](http://en.wikipedia.org/wiki/Replay_attack), ensuring that the action is performed by the user the message was sent to. Protection is achieved by adding a unique token parameter to the request parameters and verifying it when the action is invoked.\n\nThe token parameter should be generated as a key that can only be used for a specific action and a specific user. Before the requested action is performed, you should check that the token is valid and matches the one you generated for the user. If the token matches then the action can be performed and the token becomes invalid for future requests.\n\nAccess tokens should be sent to the user as part of the `url` property of the [HttpActionHandler](/workspace/gmail/markup/reference/types/HttpActionHandler). For instance, if your application handles approval requests at `http://www.example.com/approve?requestId=123`, you should consider including an additional `accessToken` parameter to it and listen to requests sent to `http://www.example.com/approve?requestId=123&accessToken=xyz`.\n\nThe combination `requestId=123` and `accessToken=xyz` is the one that you have to generate in advance, making sure that the `accessToken` cannot be deduced from the `requestId`. Any approval request with `requestId=123` and no `accessToken` or with a `accessToken` not equal to `xyz` should be rejected. Once this request gets through, any future request with the same id and access token should be rejected too."]]