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

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

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

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

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

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

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

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

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

टोकन की समयसीमा खत्म होना

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

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

अन्य इवेंट

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

Google, टोकन रद्द करने का एंडपॉइंट लागू करें, ताकि Google उसे कॉल कर सके. साथ ही, RISC का इस्तेमाल करके, 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).