2017-11-22 138 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" bloğundaki yorumlarda sahip olduğunuz 2 satırı okudunuz mu? – pleft

+3

Aslında yaptım ama durum kodu 10 hakkında hiçbir şey yok, o yüzden anlayamıyorum. –

cevap

5

Bu durum kodu, bilinmeyen bir sunucu istemci kimliği sağladığınız anlamına gelir. Projenizde https://console.developers.google.com/apis/credentials adresinde şunları üretmeniz gerekebilir: OAuth istemci kimliği -> Web Uygulaması ve bu web uygulaması istemci kimliğini Android uygulamanızda kullanmanız gerekebilir.

+0

Ayrıca, paketinizi aynı https://console.developers.google.com/apis/credentials adresine eklemiş veya yanlış yazmış olabilirsiniz, ancak Android için Oauth 2.0 Müşteri Kimliği'nde. – bojan

İlgili konular