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

उपयोगकर्ता का अनुभव आपके प्लैटफ़ॉर्म या 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).