2017-11-22 14 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

क्या आपने 'कैच' ब्लॉक में टिप्पणियों में 2 लाइनें पढ़ी हैं? – pleft

+3

असल में मैंने किया लेकिन स्थिति कोड 10 के बारे में कुछ भी नहीं है, इसलिए मुझे यह नहीं मिला। –

उत्तर

5

यह स्थिति कोड का अर्थ है कि आप अज्ञात सर्वर क्लाइंट आईडी प्रदान कर रहे हैं। आपकी परियोजना में https://console.developers.google.com/apis/credentials में आपको उत्पन्न करने की आवश्यकता हो सकती है: OAuth क्लाइंट आईडी -> वेब एप्लिकेशन और अपने एंड्रॉइड ऐप में इस वेब एप्लिकेशन क्लाइंट आईडी का उपयोग करें।

+0

यह भी हो सकता है कि आपने अपने पैकेज को उसी https://console.developers.google.com/apis/credentials में जोड़ा या गलत वर्तनी नहीं की है, लेकिन एंड्रॉइड के लिए ओथ 2.0 क्लाइंट आईडी में। – bojan

संबंधित मुद्दे