애플 로그인 on Android
이 플러그인의 설치 단계와 전체 마크다운 가이드를 포함한 설정 프롬프트를 복사하세요.
안드로이드에서 애플 로그인은 약간의 장난감입니다. 애플은 안드로이드에서 공식적으로 지원하지 않습니다. Sign in with Apple 안드로이드에서 현재 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를 생성하는 방법-
로그인하여 애플 개발자 포털.
-
애플 개발자 포털 Identifiers 섹션
Identifiers.
애플 개발자 포털 Identifiers 화면
- 앱 ID를 찾을 수 있는지 확인해 보세요.
App IDs - 앱 ID를 찾을 수 있는지 확인해 보세요.
- 앱 ID를 찾을 수 있는지 확인해 보세요.
-
앱에
Sign in with Apple선택하세요- 리스트에서 앱을 선택하세요
- 체크박스
Sign in with Apple사용자 인증에
- 사용자 인증에
- 리스트에서 앱을 선택하세요
-
이전으로 돌아가기
All Identifiers
-
클릭하여
App Ids및 이동Services IDs
-
새로운 식별자 만들기
-
플러스 버튼 클릭
-
선택
Servcice IDs및 클릭Continue
-
설명과 식별자 입력 후 클릭
Continuie.
-
세부 사항을 확인하고 클릭하세요.
Register
-
새로 생성된 서비스에 클릭하세요.
-
기능을 활성화하세요.
Sign in with AppleSign in with Apple 기능을 활성화하는
-
Configure 버튼을 클릭하여 Sign in with Apple을 구성하세요.
Sign In with Apple
-
이러한 것을 확인하십시오.
Primary App ID__CAPGO_KEEP_0__을 __CAPGO_KEEP_1__에 설정하십시오.
-
이미지 호스팅을 위해 사용할 도메인을 추가하십시오.
-
데이터를 확인하고 클릭하세요.
Done
-
서비스 설정을 위해
Continue
-
설정 완료를 위해
Save
-
키를 생성합니다.
키 생성을 위한 섹션입니다.-
모두로 돌아가세요.
All Identifiers
-
설정 완료를 위해 클릭하세요.
Keys
-
플러스 아이콘을 클릭하세요
-
키 이름을 입력하세요
-
클릭
Sign in with AppleApple Sign in을 위한 키를 설정하고 구성하세요Configure
-
Apple Sign in을 위한 키를 활성화하고 구성하세요
Save
-
클릭
Continue
-
클릭
Register
-
키 ID를 복사하고 키를 다운로드하세요.
-
다운로드 한 키를 찾으시고 백엔드 폴더에 저장하세요.
팀 ID를 가져오는 방법
팀 ID를 가져오는 방법안드로이드에서 사용하기 위해 Login with Apple 이 키를 백엔드에서 사용합니다. Team ID팀 ID를 가져오려면
-
이 웹사이트로 이동하세요 이 키는 백엔드에서 사용됩니다. __CAPGO_KEEP_0__
-
__CAPGO_KEEP_1__
Team ID
__CAPGO_KEEP_3__
__CAPGO_KEEP_4____CAPGO_KEEP_5__ Redirect back to the app__CAPGO_KEEP_6__
- __CAPGO_KEEP_7__
AndroidManifest.xml-
__CAPGO_KEEP_8__
AndroidStudio
-
__CAPGO_KEEP_10__
MainActivity__CAPGO_KEEP_11__
<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-
__CAPGO_KEEP_0__을 열어주세요
MainActivity
-
다음과 같은 code을 추가하세요
@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:
- 간단한 JSON 데이터베이스
- 애플 서버에서 JWT를 요청하는 방법
- JWT 검증의 간단한 방법
__CAPGO_KEEP_0__ env __CAPGO_KEEP_0__
ANDROID_SERVICE_ID__CAPGO_KEEP_0__IOS_SERVICE_ID= 앱 ID
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' }})앱을 만들기 위해
Section titled “Creating the app”-
앱 ID가 아직 없는 경우 플러스 버튼을 클릭하십시오
-
Select
App IDsand click continue
-
타입 클릭
App클릭Continue
-
설명과 앱 ID를 입력하세요
-
활성화
Sign with Apple기능
-
클릭
Continue
-
상세 내용 확인 후 클릭
Register
안드로이드에서 애플 로그인으로 계속하기
안드로이드에서 애플 로그인으로 계속하기애플 로그인과 같은 인증 및 계정 흐름을 계획하고 있다면 애플 로그인 애플 로그인과 같은 인증 및 계정 흐름을 계획하고 있다면 @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-social-login을 사용하세요. @capgo/capacitor-social-login @capgo/capacitor-social-login @capgo/capacitor-passkey @capgo/capacitor-passkey @capgo/capacitor-passkey @capgo/capacitor-passkey @capgo/capacitor-native-생체인식 for the implementation detail in @capgo/capacitor-native-생체인식, and 두 단계 인증 for the implementation detail in 두 단계 인증.