애플 로그인 (안드로이드)
설치 단계와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 지시를 복사하세요.
Apple 로그인은 안드로이드에서 HACKY합니다. Apple은 안드로이드에서 공식적으로 지원하지 않습니다. Sign in with Apple 안드로이드에서 Apple 로그인을 사용하는 방법은 약간 HACKY합니다.
안드로이드에서는 현재 Chrome 탭을 사용하여 OAuth2 웹사이트를 표시합니다. 이 접근 방식에는 다음 문제점이 있습니다.
- 구성하기 어려움
- 백엔드가 필요합니다
안드로이드에서 흐름을 이해하는 것이 어렵습니다.
안드로이드에서 흐름을 이해하는 방법흐름을 이해하는 안드로이드 다이어그램
flowchart TD
A("await SocialLogin.login()") -->|Handled in the plugin|B(Generate the login URL)
B --> |Pass the link| C(Open the Chrome browser)
C --> D(Wait for the user to login)
D --> |Apple redirects to your backend|E(Handle the data returned from Apple)
E --> F(Redirect back to the app)
F --> G(Return to JS) 현재 흐름과 문제점을 이해하셨다면, 구성 방법을 시작해 보겠습니다.
서비스 ID를 생성합니다.
서비스 ID 생성-
Apple Developer Portal에 로그인합니다. Apple Developer Portal.
-
Apple Developer Portal Identifiers 섹션을 클릭합니다.
Identifiers.
다음과 같은 화면을 볼 수 있습니다.
- 이 필드가 다음과 같이 표시되어야 합니다.
App IDs - App ID를 찾을 수 있습니다.
- 이 필드가 다음과 같이 표시되어야 합니다.
-
단계를 통해 하나를 생성하세요.
Sign in with Apple앱에- 리스트에서 앱을 선택하세요.
- 리스트에서 앱을 선택하세요.
Sign in with Apple체크박스를 클릭하세요.
- 모두로 돌아가세요.
- 리스트에서 앱을 선택하세요.
-
모두로 돌아가세요.
All Identifiers
-
클릭하여
App Ids및 이동Services IDs
-
새 식별자 만들기
-
플러스 버튼 클릭
-
선택
Servcice IDs및 클릭Continue
-
설명과 식별자 입력 후 클릭
Continuie.
-
세부 정보를 확인하고 클릭하세요
Register
-
새로 생성된 서비스 ID를 클릭하세요
-
Enable the
Sign in with Appleoption
-
Configure the
Sign In with Apple
-
서비스 ID에서 Sign in with Apple을 활성화하는 것을 확인하세요
Primary App ID__CAPGO_KEEP_0__을 이전 단계에서 설정한 App ID로 설정합니다.
-
백엔드 호스팅을 위해 사용할 도메인을 추가하세요.
-
데이터를 확인하고 클릭하세요.
Done
-
클릭하세요.
Continue
-
클릭하세요.
Save
-
키 생성 중입니다.
키 생성 섹션-
모두로 돌아가기
All Identifiers
-
클릭하세요.
Keys
-
Click on the plus icon
-
키 이름을 입력하세요
-
선택
Sign in with Apple클릭Configure
-
주 App ID를 선택하고
Save
-
클릭하여
Continue
-
클릭하여
Register
-
키 ID를 복사하고 키를 다운로드하세요.
-
다운로드 한 키를 찾고 백엔드 폴더에 저장하세요.
팀 ID를 얻는 방법
팀 ID를 얻는 방법__CAPGO_KEEP_2__를 사용하려면 Login with Apple 안드로이드에서 __CAPGO_KEEP_2__를 얻어야 합니다. Team ID백엔드에서 사용됩니다.
-
__CAPGO_KEEP_3__로 이동하세요. 이 웹사이트로 이동하세요. 스크롤을 내려주세요.
-
Find the
Team ID
앱 리다이렉트 설정
앱 리다이렉트 설정을 위한 섹션그림에서 보신 것처럼 백엔드에서는 Redirect back to the app단계를 수행합니다. 이 작업은 앱의 수동 변경이 필요합니다.
- 수정하세요
AndroidManifest.xml-
파일을 열어보세요. 나는
AndroidStudio
-
팀 ID 위치를 찾으세요
MainActivityMainActivity에 다음 인텐트 필터를 추가하세요
<intent-filter><action android:name="android.intent.action.VIEW" /><category android:name="android.intent.category.DEFAULT" /><category android:name="android.intent.category.BROWSABLE" /><data android:scheme="capgo-demo-app" android:host="path" /></intent-filter>
-
- Modify the
MainActivity-
Please open the
MainActivity
-
code를 MainActivity에 추가하여 깊이 링크를 처리하는 데 사용하세요
@Overrideprotected void onNewIntent(Intent intent) {String action = intent.getAction();Uri data = intent.getData();if (Intent.ACTION_VIEW.equals(action) && data != null) {PluginHandle pluginHandle = getBridge().getPlugin("SocialLogin");if (pluginHandle == null) {Log.i("Apple Login Intent", "SocialLogin login handle is null");return;}Plugin plugin = pluginHandle.getInstance();if (!(plugin instanceof SocialLoginPlugin)) {Log.i("Apple Login Intent", "SocialLogin plugin instance is not SocialLoginPlugin");return;}((SocialLoginPlugin) plugin).handleAppleLoginIntent(intent);return;}super.onNewIntent(intent);}
-
여기 This example provides the following:
A simple JSON database
- Backend configuration
- Apple 서버에서 JWT를 요청하는 방법
- JWT를 간단하게 검증하는 방법
= 서비스 ID env = 앱 ID
ANDROID_SERVICE_ID__CAPGO_KEEP_0__IOS_SERVICE_ID__CAPGO_KEEP_1__
env: { PRIVATE_KEY_FILE: "AuthKey_U93M8LBQK3.p8", KEY_ID: "U93M8LBQK3", TEAM_ID: "UVTJ336J2D", ANDROID_SERVICE_ID: "ee.forgr.io.ionic.starter.service2", IOS_SERVICE_ID: "me.wcaleniewolny.test.ionic.vue", PORT: 3000, REDIRECT_URI: "https://xyz.wcaleniewolny.me/login/callback", BASE_REDIRECT_URL: "capgo-demo-app://path"}플러그인을 사용하는 방법
플러그인을 사용하는 방법사용법 login 함수 사용법은 IOS와 동일합니다. 더 많은 정보를 확인하려면 해당 섹션을 참조하세요. 그러나, initialize 복사하기
await SocialLogin.initialize({ apple: { clientId: 'ee.forgr.io.ionic.starter.service2', redirectUrl: 'https://appleloginvps.wcaleniewolny.me/login/callback' }})앱을 만들기 위해
Creating the app-
iOS용 Apple Login을 구성한 경우 이 단계를 건너 뛰세요. App ID가 이미 있는 경우 이 단계를 건너 뛰세요. App ID가 이미 있는 경우 이 단계를 건너 뛰세요.
-
새로운 식별자 플러스 버튼
App IDs선택
-
타입을 클릭하세요
App클릭하세요Continue
-
설명과 앱 ID를 입력하세요
-
켜기
Sign with AppleApple 로그인 기능
-
클릭
Continue
-
세부 정보를 확인하고 클릭하세요
Register
애플 로그인에서 계속
애플 로그인에서 계속애플 로그인을 사용 중이라면 애플 로그인 인증 및 계정 흐름을 계획하고, @capgo/capacitor-social-login @capgo/capacitor-social-login @capgo/capacitor-social-login @capgo/capacitor-passkey @capgo/capacitor-passkey @capgo/capacitor-native-biometric @capgo/capacitor-native-biometric @capgo/capacitor-native-biometric, and 두 단계 인증 @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-native-biometric.