Azure

2016-09-09 12 views
17

के माध्यम से Google लॉगिन त्रुटि मेरे ऐप में मैं Google लॉगिन का उपयोग करना चाहता हूं, इसलिए इसके लिए मैं Azure Services का उपयोग कर रहा हूं। गूगल से, मैं सफलतापूर्वक प्रवेश और सभी विवरण प्राप्त करने में सक्षम हूँ, लेकिन Azure पक्ष पर निम्न त्रुटि होती है:Azure

Error Domain=com.Microsoft.WindowsAzureMobileServices.ErrorDomain Code=-1302 "Error: The id_token issuer is invalid." UserInfo={NSLocalizedDescription=Error: The id_token issuer is invalid.}

कोड:

if (user.authentication != nil) 
{ 

    let delegate = UIApplication.sharedApplication().delegate as? AppDelegate 

    let client = delegate!.client!; 

    //    let nextViewController = self.storyboard?.instantiateViewControllerWithIdentifier("SWRevealViewController") as! SWRevealViewController 

    //    self.presentViewController(nextViewController, animated: true, completion: nil) 

    let payload: [String: String] = ["id_token": idToken] 

    client.loginWithProvider("google", token: payload, completion: { (user, error) in 

     if error != nil{ 

      //here i am getting the above mentioned error 
      print(error) 

     } 

     if user != nil{ 

      print(user) 



      print("Google Login Sucess") 

      self.call(false, email: email, firstName: firstName, lastName: lastName, id: googleId, token: idToken,imageUrl: imageUrl.absoluteString) 

     } 

    }) 

} 



    override func viewDidLoad() 
    { 

     super.viewDidLoad(); 



     GIDSignIn.sharedInstance().signOut() 

     GIDSignIn.sharedInstance().scopes.append("https://www.googleapis.com/auth/plus.login"); 

     GIDSignIn.sharedInstance().clientID = "XXXXXXXX"; 

     GIDSignIn.sharedInstance().serverClientID = "XXXXXXXXX" 

     GIDSignIn.sharedInstance().uiDelegate = self 




    } 

मैं नहीं जानता इस टोकन मुद्दा है कि क्या या कुछ और।

+0

एक ही मुद्दे में चल रहा है - आप को हल करने में सक्षम थे यह? – user648931

+0

@ user648931 nah समस्या अभी भी तय नहीं है, अगर आपने इसे हल किया है तो कृपया मुझे बताएं। –

+0

@ user648931 क्या आपने इस मुद्दे को हल किया है? –

उत्तर

0

हमें जो प्रतिक्रिया मिलती है वह नीचे की तरह है। मुझे लगता है कि मोबाइल सेवा बैकएंड जारीकर्ता आईडी पसंद नहीं है: "https://accounts.google.com"। यह accounts.google.com स्वीकार करता

{ 
"iss": "https://accounts.google.com", 
"at_hash": "bGW4JYlbzO64NGLInOpKgg", 
"aud": "XXXXXX-XXXXXXX", 
"sub": "XXXXXXXXXX", 
"email_verified": "true", 
"azp": "XXXXXX-XXXXXXXXXXX", 
"hd": "techmorphosis.com", 
"email": "[email protected]", 
"iat": "1477398958", 
"exp": "1477402558", 
"name": "Anuj Mody", 
"given_name": "Anuj", 
"family_name": "Mody", 
"locale": "en", 
"alg": "RS256", 
"kid": "XXXXXXXXXXXX" 
} 
0

गूगल के लिए, आप दोनों id_token और authorization_code की जरूरत है:

let payload: [String: String] = ["id_token": user.authentication.idToken, "authorization_code": user.serverAuthCode] 
    client.loginWithProvider("google", token: payload) { (user, error) in 
     // ... 
    } 

रेफरी: https://docs.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-ios-how-to-use-client-library#a-namegoogle-sdkahow-to-authenticate-users-with-the-google-sign-in-sdk-for-ios

+0

मैंने कोशिश की लेकिन अब मुझे यह त्रुटि मिल रही है "त्रुटि डोमेन = com.Microsoft.MicrosoftAzureMobile.ErrorDomain कोड = -1301" सर्वर ने एक त्रुटि लौटा दी। "UserInfo = {NSLocalizedDescription = सर्वर ने एक त्रुटि लौटा दी। " इसके अलावा मैं क्लाइंट साइड प्रमाणीकरण केवल सर्वर पक्ष नहीं चाहता हूं। –