Facebook 로그인에 대해 앱이 잘못 구성됨 : Android Facebook 통합 문제
내 애플리케이션을 Facebook과 통합했으며이를 위해 Facebook의 Graph API를 사용하고 있습니다. 프로필 및 친구 정보를 검색하고 있습니다. Android 2.3 (Gingerbread)이 설치된 내 기기에서 잘 작동 하지만 최근 내 클라이언트가 내 앱을 통해 Facebook에 연결하는 동안 문제가 발생했습니다. 그는 기기에 Android 4.0 (Ice Cream Sandwich)이 있습니다. 그가 Facebook 로그인 화면으로 이동하는 앱의 버튼을 클릭하면 로그인 후 다음 메시지가 표시됩니다.
내 앱이 Facebook 로그인 용으로 잘못 구성되었습니다. Facebook에 연결하지 않고 애플리케이션으로 돌아가려면 확인을 누릅니다.
Android 버전과 관련이 있는지 여부에 관계없이 문제가 무엇인지 알 수 없습니다.
이 문제를 어떻게 해결할 수 있습니까?
저는 Facebook에서 일하고 있는데 이것은 해결해야 할 중요한 문제입니다. 이 질문에 대한 또 다른 대답은 SSO를 비활성화하는 것이 매우 나쁘고 사용자의 Facebook 자격 증명을 훔칠 수있는 악성 앱에 앱을 열 것임을 시사합니다 .
해킹은 SSO없이 Facebook에 WebView 대화 상자를 시작하고 사용자는 해당 대화 상자에 로그인 자격 증명을 입력해야합니다. 그러면 악성 앱이이 정보를 쉽게 훔칠 수 있습니다. 앱의 보안을 유지하고 사용자의 민감한 데이터를 보호하려면 항상 Facebook SSO를 올바르게 구현하는 것이 좋습니다.
이 오류 메시지를 추가하기 전에 대화 상자는 경고없이 자동으로 닫히고 자동으로 실패합니다. Facebook 앱 대시 보드에서 앱 구성에 문제가 있음을 시각적으로 표시하기 위해이 오류 메시지를 추가했습니다. Android의 경우 LogCat 을 확인 하면 "Okay"를 누른 후 인증 실패 원인에 대한보다 기술적 설명을 표시하는 오류 메시지가 표시됩니다.
예를 들어 Hackbook 예제를 사용하고 소스에 자체 APP_ID를 제공하지 않았고 대시 보드에 해시 키를 추가하지 않은 경우 기본 SSO 대화 상자에서 "Okay"를 누른 후 LogCat에이 오류가 표시됩니다 ( Util.ENABLE_LOG가 true로 설정 됨) :
D / Facebook-authorize (24739) : 로그인 실패 : invalid_key : Android 키 불일치. "uk3udeH7vrOGNFH2FJjdJbdWJWI"키가 애플리케이션 설정에 지정된 허용 키와 일치하지 않습니다. http://www.facebook.com/developers 에서 애플리케이션 설정을 확인하십시오 .
도움을 드리기 위해 시각적 오류 메시지를 추가했습니다. 이것은 이론적으로 .NET으로 시작하도록 올바르게 구현 된 경우 이전 구현을 깨뜨리지 않습니다 . 이 오류 메시지가 표시되면 대시 보드 에서 앱 설정을 올바르게 구성하지 않은 것입니다 .
Android 클래스 / 패키지 이름, Android 해시 키 등을 다시 확인하십시오. 모든 작업을 올바르게 수행하면이 메시지가 표시되지 않습니다.
요약 하면 대시 보드의 Android 해시 키 간의 불일치와 같이 앱 구성에 문제가 있기 때문에 해당 오류 메시지가 표시됩니다. Facebook이이 오류 메시지를 추가하기 전에 대화 상자가 시작된 다음 자동으로 닫히고 실패했습니다. 이 문제를 해결하려면 LogCat에서 오류 메시지를 확인하고 모든 것이 올바르게 구현되었는지 확인하십시오. 모든 것이 올바른지 확인하기 위해 설명서 를 읽을 수 있습니다 . 이 질문에 허용 된 답변을 사용하지 마십시오.
Facebook 개발자가 더 많은 업데이트를보고 한 외부 버그 보고서 를 따를 수도 있습니다.
다음과 같이 설정하십시오.
먼저 OpenSSL을 다운로드합니다 (64 비트 컴퓨터를 사용 하는 경우 출력이 유효하지 않으므로 최신 버전이 아닌 openssl-0.9.8e X64 , openssl-0.9.8k X64를 다운로드해야 합니다). 파일을 추출하고 폴더를 생성합니다 ( openssl
예 : C : /).
keytoo의 길을 찾으십시오. 내 것은 C : \ Program Files \ Java \ jdk1.7.0_05 \ bin입니다.
에 대한 경로를 찾으십시오 debug.keystore
. YHou는 메뉴, 이클립스에서 열 경우 경로가 무엇인지 볼 수있는 창 > - 환경 설정 -> 안드로이드 -> 빌드 , 당신은 볼 것이다 기본 디버그 키 스토어를 : - 그리고 경로.
에 대한 경로를 찾으십시오 openssl
. 내 것은 C : \ openssl8e \ bin /입니다.
cmd를 열고 다음을 입력하십시오.
"C : \ Program Files \ Java \ jdk1.7.0_05 \ bin \ keytool"-exportcert -alias androiddebugkey -keystore "C : \ Users \ User.android \ debug.keystore"| "C : \ openssl8e \ bin \ openssl"sha1 -binary | "C : \ openssl8e \ bin \ openssl"base64
A를 누른 다음를 누릅니다 Enter.
비밀번호 입력 : android
에 대한 해시 키를 받게됩니다 debug.keystore
.
서명 된 APK 를 내보내고 애플리케이션에 대한 키 저장소를 만들 때 cmd debugkeystore 별칭을 앱의 별칭으로 바꾸고 키 저장소 경로를 앱에 대해 새로 만든 키 저장소의 경로로 바꾸고 app.keystore
, 서명 된 앱에 대한 새 해시 키를 받게됩니다.
Jesse Chen의 대답은 좋습니다. Facebooks SDK는 잘 작동합니다.
나는 다시이 문제에 부딪 쳤고 Facebook SDK 문서가 수정되었으며 현재 매우 괜찮다는 것을 알았습니다. 이제 해시 키를 디버깅하고 해제하는 방법을 안내합니다. 말대로하십시오.
아래는 나의 오래된 이야기입니다. 두 개의 해시 키를 설정할 수 있다는 점이 누락되었습니다. 하나는 디버깅 용이고 다른 하나는 이전 Play 스토어 용으로 서명되고 출시 된 애플리케이션 용 입니다.
나는 문제 가 Facebook SDK의 문서에서 내 경우 라는 것을 알았습니다 . 디버그 키 해시를 사용하고이를 Facebook의 앱 구성에 넣도록 안내했습니다. 해시는 다음과 같이 안내됩니다.
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
Eclipse 에서 응용 프로그램을 더 버깅하거나 실행할 때 잘 작동합니다 .
그러나 애플리케이션을 Andoid Play에 게시하는 경우 자체 게시자 키를 사용하여 서명 된 .apk 파일을 내 보내야합니다. 이 .apk를 사용하면 Facebook 앱 콘솔의 해시가 더 이상 유효하지 않습니다! 다음과 같이 개발자 키에 대한 해시를 가져와야합니다.
keytool -exportcert -alias <developer alias> -keystore ~/.android/<developer keystore> | openssl sha1 -binary | openssl base64
게시 된 애플리케이션의 Facebook 앱 콘솔에있는 Android Key Hash에 넣습니다. 그 후 SSO는 서명 된 .apk 파일에 대해 다시 정상적으로 작동합니다.
내가 모을 수 있었던 것에서 그것은 Facebook 문제이며보고되었습니다. 그러나 문제는 지속됩니다.
이 문제를 해결하는 방법 (2.3.3에서 테스트 됨)은 Facebook SDK를 해킹하고 2 개의 권한 부여 방법을 검색 하고 DEFAULT_AUTH_ACTIVITY_CODE 를 FORCE_DIALOG_AUTH로 변경하는 것 입니다. 이렇게하면 단일 사인온 기능이 비활성화됩니다.
당신이 선호한다면
public void authorize(Activity activity, String[] permissions,
int activityCode, final DialogListener listener)
startSingleSignOn 부분을 비활성화하십시오 . 결국 페이스 북이 문제를 해결할 것이고, 이전 상수를 되돌리기 만하면되기 때문에하지 않는 것이 좋습니다.
편집하다
이 솔루션은 보안 문제를 일으 킵니다. Jesse Chen 답변을 확인하십시오.
나는 같은 문제에 직면했다. 24 시간을 보내고 많은 검색을 한 후 우리는이 방법을 사용하여 문제를 해결했습니다.
예를 들어 Xcode 프로젝트의 현재 번들 식별자를 확인하십시오. com.yourcompanyname.yourappname
Facebook에서 앱을 만들 때 동일한 com.yourcompanyname.yourappname 번들 식별자를 사용하여 첨부 파일을 참조하십시오.
나는 4.0.4에서 몇 분 전에이 문제를 겪었고 저절로 해결 된 것 같습니다.
늦었지만 여전히 유용합니다. * 다음은 corerct 방법입니다 (디버그 키의 경우 릴리스에 따라 변경) : *
keytool -exportcert -alias androiddebugkey -keystore "C:\Users\<User>\.android\debug.keystore" > <Drive letter>:\debug.txt
openssl sha1 -binary "<Drive letter>:\debug.txt" > "<Drive letter>:\debug_sha.txt"
openssl base64 -in "<Drive letter>:\debug_sha.txt" > "<Drive letter>:\debug_base64.txt"
The hash is in the last generated file: debug_base64.txt....open it and copy the hash.
Remember to replace "" and with your username and drive letter of your choice
When you create the key hash, you might end up with something which has the equality sign "=" at the end, like ga0RGNYHvNM5d0SLGQfpQWAPGJ8=. While Facebook gladly accepts the equality sign as part of the key hash, you have to remove it in order for it to work.
Additionally, check out the accepted answer to Android Facebook SDK 3.0 gives "remote_app_id does not match stored id" while logging in: when getting the key hash for the debug keystore, use the password "android". Otherwise the key hash will be incorrect and you will get the error specified in the question (be nice and vote up the answer there if it helped you.)
Regarding apps signed with OWN keystore: After spending several hours solving this issue, I finally got it and want to provide an answer for those who are still suffering:
My steps: I signed my app via eclipse with my own keystore file (NOT debug.keystore). Via command line and known commands (keytool -exportcert -alias -keystore ~/.android/ | openssl sha1 -binary | openssl base64) I successfulluy received the key hash. Pasted the key hash in the dev dashboard,waited a few mins -> Still the same ERROR (as specified in the question above). i tried several differend keytools, on several jdks, etc... nothing changed.
Solution: I turned on debuggable in manifest, turned on debugging in facebook sdk. then i signed the apk with my own keystore and uploaded it on real device. i connected device via usb and opened DDMS perspective to see logcat on device.
I started my app and let the error message occur. It prints out a key totally different from the key generated by keytool. I took this key from logcat, pasted it to dev dashboard and voila -> EVERYTHING WORKS
I still don't know why this happens or what is causing the wrong key, but this way it works for me.
On Debian system like ubuntu use the keytool
of java
found under directory /usr/lib/jvm/jdk*.*.*/bin/keytool
and generate like this
/usr/lib/jvm/jdk1.7.0/bin/keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
This way you get the authentic hash key that can be put under your app hash of facebook.
Usually this problem could be solved with two check:
- flag in the facebook console to publish live the facebook configuration
- api key mismatches
I managed to solve the issue I was having with misconfigured for Facebook on Android by ensuring I had the correct hash key for a release version.
To get the release version hash key, find the key you used to sign the application and do the following, insert the name of your keystore alias (without brackets). If you don't know your alias this can be found by exporting your app as a signed app and the alias is on the second page of the wizard. Also insert the path to your keystore (without brackets).
keytool -exportcert -alias [Alias of your keystore] -keystore [Path to keystore] | openssl sha1 -binary | openssl base64
I did a Toast
for exceptions and found it throws a key mismatch exception today added the key in the FB
app page and it works fine
Also encountered this issue.
Simply go to the Facebook developers getting started page here
and follow step 4 - the thing with the command line.
Worked for me.
Enjoy.
I just had the same problem and the solution turned out to be super simple. When I created the app in the dashboard, I only had added the key hash for the android debug keystore. This all works fine if you install the app as a developer via a USB cable in this case.
Once you have an app in the Play Store, you will use a production key to sign the app. This also means, that you have to get the key hash of the production key like for the debug key and add it as a second hash to the list of native app hashes.
just to remember you how the key hash works: keytool -exportcert -alias -keystore ~/keys/android_keystore | openssl sha1 -binary | openssl base64
Hope that helps!
I had a similar problem, but for iOS.
The solution is to do with configuring the Facebook app on the Facebook developer daskboard.
For iOS, 2 things must be done:
Enabled Facebook Login
Bundle ID must be the same as the app
It's a keystore issue..configure your eclipse to use the same keystore for which app was configured for.
I got the same error a few days ago. In my case it was due to an Android key mismatch. Here is how I fixed it if it may help you too:
Open Util.java in the Facebook SDK, set private static boolean ENABLE_LOG = true;
. Now run your app and enter your email id and password. Facebook sends back a signature if there's a key mismatch. You'll find this key (signature) in LogCat. Just copy this key and paste it in the app dashboard. That should fix the problem. Remember to set private static boolean ENABLE_LOG = true;
back to false.
'Nice programing' 카테고리의 다른 글
Django에서 manage.py를 사용하여 CLI에서 데이터베이스를 지우는 가장 쉬운 방법은 무엇입니까? (0) | 2020.10.16 |
---|---|
Java 7은 방화벽이 켜져있는 경우 Windows Vista 및 7에서 FTP 전송을 차단합니다. (0) | 2020.10.16 |
ASP.NET C #에서 이메일을 보내는 방법 (0) | 2020.10.16 |
composer create-project를 사용하여 특정 laravel 버전 설치 (0) | 2020.10.16 |
VirtualAlloc과 HeapAlloc의 차이점은 무엇입니까? (0) | 2020.10.16 |