تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
غالبًا ما يتطلّب محتوى الرسائل الإلكترونية المخصّصة الديناميكية مصادقة المستخدم.
ومع ذلك، لحماية بيانات المستخدمين، يتم إعادة توجيه جميع طلبات HTTP التي يتم إجراؤها من داخل رسائل AMP المرسَلة عبر Gmail
داخل Gmail ويتمّ تجريدها من ملفات تعريف الارتباط.
لمصادقة الطلبات المقدَّمة من رسائل AMP الإلكترونية، يمكنك استخدام
الرموز المميزة للوصول.
رموز الدخول
يمكنك استخدام الرموز المميّزة للوصول إلى المصادقة على المستخدم. يقدّم مُرسِل الرسالة الإلكترونية رموز الوصول ويتحقق منها. يستخدم المُرسِل الرموز المميّزة لضمان
أنّه لا يمكن لغير مستخدمي رسالة AMP الإلكترونية تقديم الطلبات الواردة
في تلك الرسالة. يجب أن تكون رموز الوصول آمنة من الناحية المشفّرة ومحدودة زمنيًا
وحسب النطاق. ويتم تضمينها في عنوان URL للطلب.
يوضّح هذا المثال استخدام <amp-list> لعرض البيانات التي تمّت مصادقتها:
يتناول المثال التالي خدمة افتراضية لأخذ الملاحظات تتيح
للمستخدمين الذين سجّلوا الدخول إضافة ملاحظات إلى حساباتهم وعرضها لاحقًا. تريد الخدمة
إرسال رسالة إلكترونية إلى المستخدم "jane@example.com" تتضمّن قائمة بتسجيلات
الملاحظات التي سجّلها سابقًا. تتوفّر قائمة ملاحظات المستخدم الحالي
في نقطة النهاية https://example.com/personal-notes بتنسيق JSON.
قبل إرسال الرسالة الإلكترونية، تنشئ الخدمة رمز أمان مبرمَج
محدود الاستخدام لحساب jane@example.com: A3a4roX9x. يتم تضمين رمز الوصول
في اسم الحقل exampletoken داخل طلب البحث على عنوان URL:
تاريخ التعديل الأخير: 2025-03-24 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-03-24 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Authenticating requests in AMP for Email\n\nDynamic personalized email content often requires authenticating the user.\nHowever, to protect user data all HTTP requests made from inside AMP emails\nwithin Gmail are proxied and stripped of cookies.\n\nTo authenticate requests made from AMP emails, you may use\n[access tokens](#access_tokens).\n\nAccess tokens\n-------------\n\nYou can use access tokens to authenticate the user. Access tokens are\nsupplied and checked by the email sender. The sender uses the tokens to ensure\nthat only those with access to the AMP email can make the requests contained\nwithin that email. Access tokens must be cryptographically secure and time- and\nscope-limited. They are included within the URL of the request.\n\nThis example demonstrates using `\u003camp-list\u003e` to display authenticated data: \n\n \u003camp-list src=\"https://example.com/endpoint?token=REPLACE_WITH_YOUR_ACCESS_TOKEN\"\n height=\"300\"\u003e\n \u003ctemplate type=\"amp-mustache\"\u003e\n ...\n \u003c/template\u003e\n \u003c/amp-list\u003e\n\nSimilarly when using `\u003camp-form\u003e`, place your access token in the `action-xhr`\nURL. \n\n \u003cform action-xhr=\"https://example.com/endpoint?token=REPLACE_WITH_YOUR_ACCESS_TOKEN\" method=\"post\"\u003e\n \u003cinput type=\"text\" name=\"data\"\u003e\n \u003cinput type=\"submit\" value=\"Send\"\u003e\n \u003c/form\u003e\n\n| **Note:** Email clients typically strip the AMP mime part on reply / forward. \n|\n| Also, Gmail only considers an AMP part to be useable for 30 days after it is received so the lifetime of your access token should be set to 31 days.\n\n### Example\n\nThe following example considers a hypothetical note-taking service that lets\nlogged-in users to add notes to their account and view them later. The service\nwants to send an email to a user, `jane@example.com`, that includes a list of\nnotes they previously took. The list of the current user's notes is available\nat the endpoint `https://example.com/personal-notes` in JSON format.\n\nBefore sending the email, the service generates a cryptographically secure\nlimited-use access token for `jane@example.com: A3a4roX9x`. The access token is\nincluded in the field name `exampletoken` inside the URL query: \n\n \u003camp-list src=\"https://example.com/personal-notes?exampletoken=A3a4roX9x\" height=\"300\"\u003e\n \u003ctemplate type=\"amp-mustache\"\u003e\n \u003cp\u003e{{note}}\u003c/p\u003e\n \u003c/template\u003e\n \u003c/amp-list\u003e\n\nThe endpoint `https://example.com/personal-notes` is responsible for validating\nthe `exampletoken` parameter and finding the user associated with the token.\n\nFor more information, see\n[Limited use access tokens](/workspace/gmail/markup/actions/limited-use-access-tokens).\n| **Note:** A conventional web application could query the user notes endpoint with an XMLHttpRequest (XHR), and a cookie could provide the endpoint with the user's identity. In AMP for email, however, this approach doesn't work because all HTTP requests are anonymized in Gmail AMP emails. Instead, AMP must identify the user in the URL itself."]]