계정 연결 해제

플랫폼 또는 Google에서 연결 해제를 시작할 수 있으며 두 가지 모두에 일관된 링크 상태가 표시되어 최상의 사용자 환경을 제공합니다. Google 계정 연결의 경우 토큰 취소 엔드포인트 또는 교차 계정 보호는 선택사항입니다.

다음과 같은 방법으로 계정이 연결 해제될 수 있습니다.

  • 사용자 요청
    • Google 애플리케이션 또는 Google 계정 설정
    • 내 플랫폼
  • 만료된 갱신 토큰 갱신 실패
  • 귀하 또는 Google에서 시작한 기타 이벤트 예를 들어 악용 및 위협 감지 서비스에 의한 계정 정지가 있습니다.

사용자가 Google에서 연결 해제를 요청함

사용자의 Google 계정 또는 앱에서 계정 연결 해제가 시작되면 이전에 발급된 액세스 및 갱신 토큰이 삭제되고 사용자 동의가 삭제되며, 원하는 경우 토큰 취소 엔드포인트를 호출합니다.

사용자가 플랫폼에서 연결 해제를 요청함

사용자가 연결을 해제하는 메커니즘을 제공해야 합니다(예: 계정 URL). 사용자에게 연결 해제 방법을 제공하지 않는 경우 사용자가 연결된 계정을 관리할 수 있도록 Google 계정 링크를 포함합니다.

위험 및 사고 공유 및 공동작업 (RISC)을 구현하고 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.

교차 계정 보호 (RISC)

如果您支持跨帐号保护,则您的平台可以在访问令牌或刷新令牌被撤消时通知 Google。这样一来,Google 就可以告知用户链接状态的变化、使令牌失效、清理安全凭据以及进行授权授权。

跨帐号保护基于 OpenID Foundation 开发的 RISC 标准

系统会使用安全事件令牌来通知 Google 令牌撤消情况。

解码后,令牌撤消事件如以下示例所示:

{
  "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"
    }
  }
}

用于向 Google 通知令牌撤消事件的安全事件令牌必须符合下表中的要求:

令牌撤消事件
iss 颁发者声明:这是您托管的网址,在注册期间与 Google 共享。
aud Audience Claim:将 Google 标识为 JWT 接收者。它必须设置为 google_account_linking
jti JWT ID 声明:这是您为每个安全性事件令牌生成的唯一 ID。
iat Issued At Claim(在声明期间颁发):这是一个 NumericDate 值,表示此安全性事件令牌的创建时间。
toe Time of Event Claim:这是一个可选的 NumericDate 值,表示令牌撤消的时间。
exp 到期时间声明:请勿添加此字段,因为导致此通知的事件已经发生。
events
安全性事件声明:这是一个 JSON 对象,必须仅包含一个令牌撤消事件。
subject_type 此字段必须设置为 oauth_token
token_type 这是要撤消的令牌类型,可以是 access_tokenrefresh_token
token_identifier_alg 这是用于对令牌进行编码的算法,必须为 hash_SHA512_double
token 这是已撤消令牌的 ID。

如需详细了解字段类型和格式,请参阅 JSON Web 令牌 (JWT)