Problem Statement
-
eas credentials
를 통해 keystore를 download하여 firebase console에 등록
- firebase console에서
google-services.json
을 다운로드 받고 프로젝트에 첨부
-
구글로 로그인하기 버튼을 눌렀을 때
DEVELOPER_ERROR
가 발생하였다.구글로 로그인하기 버튼을 눌렀을 때 호출되는 함수
import { GoogleSignin } from '@react-native-google-signin/google-signin'; await GoogleSignin.hasPlayServices(); await GoogleSignin.signIn();
에러 내용
(NOBRIDGE) ERROR Warning: com.google.android.gms.common.api.ApiException: DEVELOPER_ERROR This error is located at: in Index ...
용어 정리
Signing Key
- APK에 디지털 서명을 생성하기 위해 사용하는 개인키(private key)
💡 디지털 서명에다가 복호화를 시도하여, computed_hash == decrypted_hash이면 올바른 private key를 가지고 있는 사람으로부터 데이터가 전송되었다고 할 수 있다. 만약 computed_hash == decrypted_hash이면 잘못된 private key를 가지고 있는 사람으로부터 데이터가 전송되었으므로 신뢰할 수 없는 데이터라고 할 수 있다.
Certificate
개인키에서 파생된 공개키(public key)와 메타정보(발행자, 유효기간 등)을 묶은 것
SHA-1 Fingerprint
인증서를 SHA-1로 요약한 식별자
Cause
/app/build.gradle
을 확인해보면 signingConfigs.debug.storeFile
이 debug.keystore
파일을 참조한다는 것을 알 수 있다. 즉, 프로젝트마다 생성되는 debug.keystore
파일 안의 sha-1 fingerprint이 사용되고 있다. 그리고 eas credentials
의 경우에는 디버깅용 앱이 아닌 프로덕션 빌드(eas build
)에만 적용이 되기에 eas credentials
로 가져온 sha-1 fingerprint를 firebase console에 등록해도 소용이 없다. 따라서 expo run:android
로 firebase auth를 이용할 경우 DEVELOPER_ERROR
가 발생한다.
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
expo run:android
- 로컬에서 debug apk를 설치하고 실행하는 script이다.
- hot reload 및 debug tool 사용 가능하다.
eas build --local
-
eas.json
의 설정한 build 설정을 이용하여 preview/production용 apk을 생성하는 과정이다. - google play나 app store 제출용으로 사용 가능하다.
Solution
expo run:andorid
를 통해 debug apk를 빌드 및 설치할 경우, eas credentials와 관계 없이 android/app/debug.keystore
에 별도의 SHA-1 fingerprint 값이 저장된다. 이 값은 다음 script를 통해 알아낼 수 있다.
keytool -list -v -keystore ./android/app/debug.keystore
흥미로운 점은, /android
디렉토리를 모두 삭제한 뒤에 다시 expo run:android
로 재성성해도 동일한 SHA-1 fingerprint를 가진다는 것이다.
Limitation
이 방법은 안드로이드 또는 react native 개발자가 소수일 경우에만 사용해볼만 하다. 팀 내부에 여러 안드로이드 또는 react native 개발자가 있을 경우 팀원들 각 기기의 fingerprint 값을 모두 firebase console에 등록해야 하기 때문에, 대규모 팀의 경우에는 권한을 관리하기 쉽도록 팀원들이 모두 같은 debug keystore
를 사용할 수 있도록 등록하는 것이 효과적일 것이다.
Question
여전히 남는 의문점이 있다. /android
디렉토리를 삭제하고 expo run:android
를 실행하더라도 debug.keystore의 sha-1 fingerprint의 값을 확인해보면 이전과 같은 것을 확인할 수 있다. 즉 deterministic하다는 것이다. 이런 현상은 어떻게 발생하는 건지 알고 있다면 제보 부탁드린다.
Top comments (0)