إلغاء ربط الحسابات

يمكن أن يبدأ إلغاء الربط من النظام الأساسي الذي تستخدمه أو Google، وأن عرض حالة رابط متسقة على كل منهما يقدم أفضل تجربة للمستخدم. ويُعدّ دعم دعم نقطة نهاية رمز مميز أو ميزة "الحماية العابرة للحساب" اختياريًا لربط حسابك على Google.

يمكن أن يتم إلغاء ربط الحسابات من خلال أي مما يلي:

  • طلب المستخدم من
    • تطبيق Google أو إعدادات حساب Google
    • النظام الأساسي الخاص بك
  • تعذّر تجديد رمز مميز منتهي الصلاحية لإعادة التحميل
  • الأحداث الأخرى التي بدأتها أنت أو Google على سبيل المثال، تعليق الحساب عن طريق خدمات إساءة الاستخدام واكتشاف التهديدات.

طلبَ المستخدم إلغاء الربط بحساب Google

يؤدي إلغاء ربط الحساب الذي تم بدؤه من خلال حساب المستخدم على Google أو تطبيقه إلى حذف أي رموز مميّزة لإذن الوصول والتحديث سابقًا، وإزالة موافقة المستخدم، والاتصال اختياريًا بنقطة نهاية الرمز المميز إذا اخترت تنفيذ أحدها.

طلبَ المستخدم إلغاء الربط بالنظام الأساسي الذي تستخدمه

يجب توفير آلية للمستخدمين لإلغاء الربط بها، مثل عنوان URL في حسابهم. إذا كنت لا توفّر طريقة للمستخدمين لإلغاء الربط، يمكنك تضمين رابط إلى حساب Google حتى يتمكّن المستخدمون من إدارة الحساب المرتبط.

يمكنك اختيار تنفيذ المخاطر والتعاون ومشاركة الحوادث (RISC) وإبلاغ Google بالتغييرات التي تطرأ على حالة ربط حسابات المستخدمين. ويسمح هذا الإجراء بتحسين تجربة المستخدم حيث تعرض كل من المنصّة وGoogle حالة ربط حالية ومتسقة بدون الحاجة إلى الاعتماد على طلب إعادة تحميل أو رمز الدخول لتعديل حالة الربط.

انتهاء صلاحية الرمز المميز

لتقديم تجربة سلسة للمستخدم وتجنُّب انقطاع الخدمة، تحاول Google تجديد الرموز المميزة لإعادة التحميل عند اقتراب نهاية عمرها الافتراضي. في بعض السيناريوهات، قد يُطلب من المستخدم الحصول على موافقة لإعادة ربط الحسابات في حال عدم توفّر رمز مميّز صالح لإعادة التحميل.

إنّ تصميم المنصّة لإتاحة استخدام عدة رموز مميّزة غير منتهية الصلاحية وإعادة التحميل يمكن أن يساعد في الحدّ من حالات العرقلة في تبادلات خوادم العملاء بين البيئة المجمّعة وتجنُّب انقطاع الخدمة والحدّ من التوقيت المعقّد وسيناريوهات معالجة الأخطاء. وفي الوقت نفسه، قد يتم استخدام كل من الرموز المميزة السابقة والتي انتهت صلاحيتها حديثًا لفترة زمنية قصيرة أثناء عملية تبادل الرموز المميزة بين العميل والخادم وقبل مزامنة المجموعة. على سبيل المثال، طلب Google لخدمتك الذي يستخدم رمز الدخول السابق غير المنتهية الصلاحية يحدث مباشرةً بعد إصدار رمز دخول جديد مباشرةً، ولكن قبل إجراء المزامنة ومزامنة المجموعة في Google. يُنصح باتخاذ إجراءات أمان بديلة لإعادة تحميل تدوير الرمز المميّز.

الأحداث الأخرى

يمكن إلغاء ربط الحسابات لأسباب أخرى متعددة، مثل عدم النشاط والتعليق والسلوك الضار وما إلى ذلك. في مثل هذه السيناريوهات، يمكن لنظامك الأساسي وGoogle إدارة حسابات المستخدمين على أفضل نحو وإعادة الربط عن طريق إرسال إشعار بشأن التغييرات التي تطرأ على حالة الحساب والروابط الأخرى.

نفِّذ نقطة نهاية إبطال الرمز المميّز حتى تتمكّن Google من الاتصال بها، وأبلِغ Google بفعاليات إبطال الرمز المميّز باستخدام RISC لضمان الحفاظ على حالة الاتّساق في حساب المستخدم من النظام الأساسي وGoogle.

نقطة نهاية إبطال الرمز المميز

If you support an OAuth 2.0 token revocation endpoint, your platform can receive notifications from Google. This lets you inform users of link state changes, invalidate a token, and cleanup security credentials and authorization grants.

The request has the following form:

POST /revoke HTTP/1.1
Host: oauth2.example.com
Content-Type: application/x-www-form-urlencoded

client_id=GOOGLE_CLIENT_ID&client_secret=GOOGLE_CLIENT_SECRET&token=TOKEN&token_type_hint=refresh_token

Your token revocation endpoint must be able to handle the following parameters:

Revocation endpoint parameters
client_id A string that identifies the request origin as Google. This string must be registered within your system as Google's unique identifier.
client_secret A secret string that you registered with Google for your service.
token The token to be revoked.
token_type_hint (Optional) The type of token being revoked, either an access_token or refresh_token. If unspecified, defaults to access_token.

Return a response when the token is deleted or invalid. See the following for an example:

HTTP/1.1 200 Success
Content-Type: application/json;charset=UTF-8

If the token can't be deleted for any reason, return a 503 response code, as shown in the following example:

HTTP/1.1 503 Service Unavailable
Content-Type: application/json;charset=UTF-8
Retry-After: HTTP-date / delay-seconds

Google retries the request later or as requested by Retry-After.

الحماية من جميع الحسابات (RISC)

If you support Cross-Account Protection, your platform can notify Google when access or refresh tokens are revoked. This allows Google to inform users of link state changes, invalidate the token, cleanup security credentials, and authorization grants.

Cross-Account Protection is based on the RISC standard developed at the OpenID Foundation.

A Security Event Token is used to notify Google of token revocation.

When decoded, a token revocation event looks like the following example:

{
  "iss":"http://risc.example.com",
  "iat":1521068887,
  "aud":"google_account_linking",
  "jti":"101942095",
  "toe": "1508184602",
  "events": {
    "https://schemas.openid.net/secevent/oauth/event-type/token-revoked":{
      "subject_type": "oauth_token",
      "token_type": "refresh_token",
      "token_identifier_alg": "hash_SHA512_double",
      "token": "double SHA-512 hash value of token"
    }
  }
}

Security Event Tokens that you use to notify Google of token revocation events must conform to the requirements in the following table:

Token revocation events
iss Issuer Claim: This is a URL which you host, and it's shared with Google during registration.
aud Audience Claim: This identifies Google as the JWT recipient. It must be set to google_account_linking.
jti JWT ID Claim: This is a unique ID that you generate for every security event token.
iat Issued At Claim: This is a NumericDate value that represents the time when this security event token was created.
toe Time of Event Claim: This is an optional NumericDate value that represents the time at which the token was revoked.
exp Expiration Time Claim: Do not include this field, as the event resulting in this notification has already taken place.
events
Security Events Claim: This is a JSON object, and must include only a single token revocation event.
subject_type This must be set to oauth_token.
token_type This is the type of token being revoked, either access_token or refresh_token.
token_identifier_alg This is the algorithm used to encode the token, and it must be hash_SHA512_double.
token This is the ID of the revoked token.

For more information on field types and formats, see JSON Web Token (JWT).