ביטול קישור של חשבונות

ביטול הקישור יכול להתבצע מהפלטפורמה או מ-Google, והתצוגה של מצב הקישור עקבי בשתי הפלטפורמות מספקת את חוויית המשתמש הטובה ביותר. התמיכה בנקודת קצה לביטול אסימון או בהגנה על כל החשבונות היא אופציונלית בקישור לחשבון Google.

הקישור של החשבונות יכול להתבטל בגלל אחת מהסיבות הבאות:

  • בקשה של משתמש מ-
    • אפליקציה של Google או הגדרות של חשבון Google
    • הפלטפורמה שלכם
  • החידוש של אסימון רענון נכשל
  • אירועים אחרים שהתרחשו מיוזמתכם או מיוזמת Google. לדוגמה, השעיית חשבון על ידי שירותים לזיהוי איומים ושימוש לרעה.

המשתמש ביקש לבטל את הקישור ל-Google

ביטול הקישור של חשבון שמופעל דרך חשבון Google או אפליקציה של משתמש מוחק את כל אסימוני הגישה והרענון שהונפקו בעבר, מסיר את הסכמת המשתמשים. אם בחרתם להטמיע את נקודת הקצה (endpoint) של ביטול האסימון, תוכלו להפעיל את נקודת הקצה (endpoint) של ביטול האסימון.

המשתמש ביקש לבטל את הקישור לפלטפורמה שלך

עליכם לספק למשתמשים מנגנון לביטול הקישור, כמו כתובת URL לחשבון שלהם. אם אין למשתמשים אפשרות לבטל את הקישור, צריך לכלול קישור לחשבון Google כדי שהמשתמשים יוכלו לנהל את החשבון המקושר שלהם.

אתם יכולים להטמיע את התוכנית 'שיתוף אירועים ואירועי סיכון ושיתוף פעולה (RISC)' ולהודיע ל-Google על שינויים בסטטוס הקישור של חשבונות המשתמשים. כך תשפרו את חוויית המשתמש, שבה הפלטפורמה ו-Google יציגו סטטוס קישור עדכני ועקבי, בלי שתצטרכו להסתמך על בקשה לרענון או לבקשת אסימון גישה כדי לעדכן את מצב הקישור.

תפוגת האסימון

כדי לספק חוויית משתמש חלקה ולמנוע שיבושים בשירות, Google מנסה לחדש אסימוני רענון לקראת סוף משך החיים שלהם. בתרחישים מסוימים, יכול להיות שתצטרכו לקבל הסכמה מהמשתמשים כדי לקשר מחדש את החשבונות כשאסימון הרענון תקף לא זמין.

תכנון הפלטפורמה כך שתתמוך במספר אסימוני גישה ואסימוני רענון שתקפים יכול לצמצם את תנאי מרוץ (race conditions) שקיימים בחילופי נתונים בין שרת ללקוח בין סביבות מקובצות, למנוע הפרעה למשתמשים ולצמצם תרחישים מורכבים של תזמון וטיפול בשגיאות. למרות שבסופו של דבר, האסימונים החדשים והקודמים שהונפקו עשויים להיות בשימוש לפרק זמן קצר, במהלך המרת החידוש של אסימון שרת הלקוח ולפני סנכרון האשכול. לדוגמה, בקשה של 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).