2017-11-22 1 views
7
private void handleSignInResult(Task<GoogleSignInAccount> completedTask) { 
    try { 
     GoogleSignInAccount account = completedTask.getResult(ApiException.class); //exception is here 

     // Signed in successfully, show authenticated UI. 
     System.out.println("google token ---> " + account.getIdToken()); 
    } catch (ApiException e) { 
     // The ApiException status code indicates the detailed failure reason. 
     // Please refer to the GoogleSignInStatusCodes class reference for more information about this error. 
     e.printStackTrace(); 
    } 
} 
+0

'catch'블록에서 주석에있는 두 줄을 읽었습니까? – pleft

+3

사실 나는 상태 코드 10에 관해서는 아무것도 없다. 그러나 나는 그것을 얻지 못한다. –

답변

5

이 상태 코드는 알 수없는 서버 클라이언트 ID를 제공하고 있음을 의미합니다. 프로젝트에서 https://console.developers.google.com/apis/credentials의 경우 OAuth 클라이언트 ID -> 웹 애플리케이션을 생성하고 Android 앱에서이 웹 애플리케이션 클라이언트 ID를 사용해야 할 수 있습니다.

+0

동일한 https://console.developers.google.com/apis/credentials에 있지만 Android 용 Oauth 2.0 클라이언트 ID에 패키지를 추가하거나 맞춤법을 잘못 입력했을 수도 있습니다. – bojan