개요

OAuth-based App Flip Linking (App Flip) allows your users to quickly link their accounts in your authentication system to their Google Accounts. If your app is installed on your user's phone when they initiate the account linking process, they are seamlessly flipped to your app to obtain user authorization.

This approach provides a faster linking process since the user does not have to re-enter their username and password to authenticate; instead, App Flip leverages the credentials from the user's account on your app. Once a user has linked their Google Account with your app, they can take advantage of any integrations that you have developed.

You can set up App Flip for both iOS and Android apps.

This figure shows the steps for a user to link their Google account
            to your authentication system. The first screenshot shows how a user
            can select your app if their Google account is linked to your app.
            The second screenshot shows the confirmation for linking their
            Google account with your app. The third screenshot shows a
            successfully linked user account in the Google app.
Figure 1. Account linking on a user's phone with App Flip.

Requirements

To implement App Flip, you must fulfill the following requirements:

  • You must have an Android or iOS app.
  • You must own, manage and maintain an OAuth 2.0 server which supports the OAuth 2.0 authorization code flow.

OAuth-based App Flip Flow

The following sequence diagram details the interaction between the User, Google App, Your App, and Your Authorization Server for App Flip.

User Google App Your App Google Server Your Auth Server 1. Initiates linking 2. Deep link to Your App 3. Show Consent Screen 4. User Grants Consent 5. Get Auth Code 6. authorization_code 7. Return to Google App 8. Pass code to Google Server 9. Token Exchange (POST) 10. access_token, refresh_token 11. Store user tokens 12. Access user resources
Figure 2. The sequence of events in the App Flip flow. If an authorization code is provided, the token exchange happens server-to-server, the same way it does in the browser-based OAuth linking flow.

Roles and responsibilities

The following table defines the roles and responsibilities of the actors in the App Flip flow.

Actor / Component GAL Role Responsibilities
Google App / Server OAuth Client Initiates the linking process, triggers a deep link to your mobile app, exchanges the authorization code for tokens, and securely stores them to access your service's APIs.
Your App Authorization Agent Authenticates the user (typically using existing app credentials), obtains consent, and retrieves an authorization code from your server.
Your Authorization Server Authorization Server Validates authorization codes and refresh tokens, and issues access tokens to the Google Server.

OAuth 연결 승인 코드 흐름에 대한 자세한 내용은 OAuth 서버 구현을 참고하세요.

디자인 가이드라인

이 섹션에서는 앱 전환 계정 연결 동의 화면의 설계 요구사항과 권장사항을 설명합니다. Google이 앱을 호출하면 앱이 사용자에게 동의 화면을 표시합니다.

요구사항

  1. 사용자의 계정이 Google Home 또는 Google 어시스턴트와 같은 특정 Google 제품이 아닌 Google에 연결된다고 알려야 합니다.

권장사항

다음을 수행하는 것이 좋습니다.

  1. Google 개인정보처리방침을 표시합니다. 동의 화면에 Google 개인정보처리방침 링크를 포함합니다.

  2. 공유할 데이터 명확하고 간결한 언어를 사용하여 Google에 필요한 사용자 데이터와 그 이유를 사용자에게 설명합니다.

  3. 명확한 클릭 유도 문구 동의 화면에 '동의 및 연결'과 같은 명확한 클릭 유도 문구를 표시합니다. 사용자가 계정을 연결하기 위해 Google과 공유해야 하는 데이터를 이해해야 하기 때문입니다.

  4. 거부 또는 취소 기능 사용자가 연결하지 않기로 선택한 경우 뒤로 돌아가거나 거부하거나 취소할 수 있는 방법을 제공합니다.

  5. 연결 해제 기능. 사용자가 연결을 해제할 수 있는 메커니즘을 제공합니다(예: 플랫폼의 계정 설정 URL). 또는 사용자가 연결된 계정을 관리할 수 있는 Google 계정 링크를 포함할 수 있습니다.

  6. 사용자 계정을 변경할 수 있습니다. 사용자가 계정을 전환할 수 있는 방법을 제안합니다. 이는 사용자가 계정을 여러 개 보유하는 경향이 있는 경우 특히 유용합니다.

    • 사용자가 계정을 전환하기 위해 동의 화면을 닫아야 하는 경우 사용자가 OAuth 연결암시적 흐름으로 원하는 계정에 로그인할 수 있도록 복구 가능한 오류를 Google에 전송하세요.
  7. 로고를 포함합니다. 동의 화면에 회사 로고를 표시합니다. 스타일 가이드라인에 따라 로고를 배치합니다. Google 로고도 표시하려면 로고 및 상표를 참고하세요.

이 그림은 사용자 동의 화면을 설계할 때 따라야 하는 개별 요구사항과 권장사항을 설명하는 콜아웃이 있는 동의 화면의 예를 보여줍니다.
그림 2. 계정 연결 동의 화면 디자인 가이드라인

OAuth 기반 앱 플립 설정

다음 섹션에서는 OAuth 기반 앱 플립의 필수 요건과 Actions 콘솔에서 앱 플립 프로젝트를 구성하는 방법을 설명합니다.

작업을 만들고 OAuth 2.0 서버를 설정합니다.

앱 전환을 구성하려면 다음을 실행해야 합니다.

Actions 콘솔에서 앱 플립 구성

다음 섹션에서는 Actions 콘솔에서 앱 플립을 구성하는 방법을 설명합니다.

  1. 상단 탐색 메뉴에서 Develop을 클릭합니다. 그런 다음 왼쪽 탐색 메뉴에서 계정 연결을 클릭합니다.
  2. 계정 연결하기 옆에 있는 스위치를 사용 설정합니다.
  3. 계정 생성에서 아니요, 내 웹사이트에서만 계정 생성을 허용하고 싶습니다를 선택합니다.
  4. 다음을 클릭합니다.
  5. 연결 유형에서 드롭다운 메뉴를 통해 OAuth승인 코드를 선택합니다.
  6. 다음을 클릭합니다.
  7. OAuth 클라이언트 정보 아래의 모든 필드를 작성합니다. (앱 전환이 지원되지 않으면 일반 OAuth가 대체로 사용됩니다.)
  8. 다음을 클릭합니다.
  9. 계정 연결에 앱 사용 (선택사항)에서 iOS 사용 설정을 선택합니다.
  10. 범용 링크 필드를 작성합니다. 범용 링크에 관한 자세한 내용은 앱과 웹사이트가 내 콘텐츠에 연결하도록 허용 을 참고하세요.
  11. 선택적으로 클라이언트를 구성하려면 범위를 추가하고 클라이언트 구성 (선택사항)에서 범위 추가를 클릭합니다. 그렇지 않은 경우 다음을 클릭합니다.
  12. 테스트 안내에서 test (또는 다른 문자열)을 자리표시자로 입력합니다. (이 필드에 테스트 계정을 입력하는 것은 실제로 게시할 작업을 제출하는 경우에만 필요합니다.)
  13. 저장을 클릭합니다.

이제 다음 섹션으로 이동하여 iOS 또는 Android 앱에서 앱 전환을 구현할 수 있습니다.

네이티브 앱에서 앱 전환 구현

앱 플립을 구현하려면 앱에서 사용자 승인 코드를 수정하여 Google의 딥 링크를 수락해야 합니다.

기기에서 앱 플립 테스트

이제 콘솔과 앱에서 작업을 만들고 앱 전환을 구성했으므로 휴대기기에서 앱 전환을 테스트할 수 있습니다. Google 어시스턴트 앱을 사용하여 앱 전환을 테스트할 수 있습니다.

어시스턴트 앱에서 앱 전환을 테스트하려면 다음 단계를 따르세요.

  1. Actions 콘솔로 이동하여 프로젝트를 선택합니다.
  2. 상단 탐색 메뉴에서 테스트를 클릭합니다.
  3. 어시스턴트 앱에서 계정 연결 흐름을 트리거합니다.
    1. Google 어시스턴트 앱을 엽니다.
    2. 설정을 클릭합니다.
    3. 어시스턴트 탭에서 홈 컨트롤을 클릭합니다.
    4. 추가(+)를 클릭합니다.
    5. 제공업체 목록에서 작업을 선택합니다. 목록에 '[test]'라는 접두사가 붙습니다. 목록에서 [테스트] 작업을 선택하면 앱이 열립니다.
    6. 앱이 실행되었는지 확인하고 승인 흐름 테스트를 시작합니다.