खातों को अलग करना (अनलिंक करना)

लिंक हटाने की प्रोसेस, आपके प्लैटफ़ॉर्म या Google से शुरू की जा सकती है. दोनों पर लिंक की स्थिति एक जैसी दिखने से, उपयोगकर्ताओं को बेहतर अनुभव मिलता है. Google खाते को लिंक करने के लिए, टोकन रद्द करने वाले एंडपॉइंट या सभी खातों की सुरक्षा की सुविधा का इस्तेमाल करना ज़रूरी नहीं है.

खाते, इनमें से किसी भी वजह से अनलिंक हो सकते हैं:

    • से मिला उपयोगकर्ता का अनुरोध
    • Google ऐप्लिकेशन या Google खाते की सेटिंग
    • आपका प्लैटफ़ॉर्म
  • रीफ़्रेश टोकन की समयसीमा खत्म होने पर उसे रिन्यू नहीं किया जा सका
  • आपके या Google के शुरू किए गए अन्य इवेंट. उदाहरण के लिए, गलत इस्तेमाल और जोखिम का पता लगाने वाली सेवाओं की वजह से खाता निलंबित किया जाना.

उपयोगकर्ता ने Google से अनलिंक करने का अनुरोध किया है

किसी उपयोगकर्ता के Google खाते या ऐप्लिकेशन से खाता अनलिंक करने पर, पहले जारी किए गए सभी ऐक्सेस और रीफ़्रेश टोकन मिट जाते हैं. साथ ही, उपयोगकर्ता की सहमति हट जाती है. इसके अलावा, अगर आपने टोकन रद्द करने वाला कोई एंडपॉइंट लागू किया है, तो यह उसे कॉल करता है. हालांकि, ऐसा करना ज़रूरी नहीं है.

उपयोगकर्ता ने आपके प्लैटफ़ॉर्म से खाता अनलिंक करने का अनुरोध किया है

आपको उपयोगकर्ताओं को खाता अनलिंक करने का विकल्प देना होगा. जैसे, उनके खाते का यूआरएल. अगर आपने उपयोगकर्ताओं को खाता अनलिंक करने का विकल्प नहीं दिया है, तो Google खाते का लिंक शामिल करें, ताकि उपयोगकर्ता अपने लिंक किए गए खाते को मैनेज कर सकें.

आपके पास जोखिम और घटना की जानकारी शेयर करने और मिलकर काम करने (आरआईएससी) की सुविधा लागू करने का विकल्प होता है. साथ ही, उपयोगकर्ताओं के खाते को लिंक करने की स्थिति में हुए बदलावों के बारे में Google को सूचना दी जा सकती है. इससे उपयोगकर्ता को बेहतर अनुभव मिलता है. इसमें आपका प्लैटफ़ॉर्म और Google, दोनों ही लिंकिंग की मौजूदा और एक जैसी स्थिति दिखाते हैं. इसके लिए, लिंकिंग की स्थिति को अपडेट करने के लिए, रीफ़्रेश या ऐक्सेस टोकन के अनुरोध पर निर्भर रहने की ज़रूरत नहीं होती.

टोकन के खत्म होने की अवधि

उपयोगकर्ताओं को बेहतर अनुभव देने और सेवा में रुकावट से बचने के लिए, Google रीफ़्रेश टोकन के खत्म होने से पहले उन्हें रिन्यू करने की कोशिश करता है. कुछ मामलों में, मान्य रीफ़्रेश टोकन उपलब्ध न होने पर, खातों को फिर से लिंक करने के लिए उपयोगकर्ता की सहमति ज़रूरी हो सकती है.

अपने प्लैटफ़ॉर्म को इस तरह से डिज़ाइन करें कि वह कई ऐसे ऐक्सेस और रीफ़्रेश टोकन के साथ काम कर सके जिनकी समयसीमा खत्म नहीं हुई है. इससे, क्लस्टर किए गए एनवायरमेंट के बीच क्लाइंट-सर्वर के इंटरैक्शन में मौजूद रेस कंडीशन को कम किया जा सकता है. साथ ही, उपयोगकर्ता को होने वाली रुकावट से बचा जा सकता है. इसके अलावा, समय और गड़बड़ी को हैंडल करने से जुड़े मुश्किल मामलों को कम किया जा सकता है. हालांकि, दोनों टोकन कुछ समय बाद एक जैसे हो जाते हैं. फिर भी, क्लाइंट-सर्वर टोकन रिन्यूअल एक्सचेंज के दौरान और क्लस्टर सिंक्रनाइज़ेशन से पहले, कुछ समय के लिए पिछले और नए टोकन, दोनों का इस्तेमाल किया जा सकता है. उदाहरण के लिए, Google आपकी सेवा से ऐसा अनुरोध करता है जिसमें पिछले ऐक्सेस टोकन का इस्तेमाल किया गया हो. यह अनुरोध, नया ऐक्सेस टोकन जारी करने के तुरंत बाद किया जाता है. हालांकि, Google को यह टोकन मिलने और क्लस्टर सिंक होने से पहले ही यह अनुरोध किया जाता है. हमारा सुझाव है कि आप रीफ़्रेश टोकन रोटेशन के लिए, सुरक्षा के वैकल्पिक तरीके इस्तेमाल करें.

अन्य इवेंट

खातों को अनलिंक करने की कई अन्य वजहें भी हो सकती हैं. जैसे, खाते का इस्तेमाल न होना, निलंबन, नुकसान पहुंचाने वाली गतिविधि वगैरह. ऐसे मामलों में, आपका प्लैटफ़ॉर्म और Google, उपयोगकर्ता खातों को बेहतर तरीके से मैनेज कर सकते हैं. साथ ही, खाते को फिर से लिंक कर सकते हैं. इसके लिए, दोनों को खाते और लिंक की स्थिति में हुए बदलावों के बारे में एक-दूसरे को सूचना देनी होगी.

Google के लिए, टोकन रद्द करने का एंडपॉइंट लागू करें. साथ ही, आरआईएससी का इस्तेमाल करके, Google को टोकन रद्द करने के इवेंट के बारे में सूचना दें. इससे यह पक्का किया जा सकेगा कि आपका प्लैटफ़ॉर्म और 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.

क्रॉस-खाता सुरक्षा (आरआईएससी)

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).