Son*_*war 18 azure ios azure-mobile-services swift
在我的应用程序中,我想使用Google登录,因此我使用的是Azure服务.从Google,我能够成功登录并获取所有详细信息,但Azure端发生以下错误:
Error Domain = com.Microsoft.WindowsAzureMobileServices.ErrorDomain Code = -1302"错误:id_token发行者无效." UserInfo = {NSLocalizedDescription =错误:id_token发行者无效.}
码:
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
}
Run Code Online (Sandbox Code Playgroud)
我不知道这是否是令牌问题或其他问题.
小智 1
我们得到的响应如下所示。我认为移动服务后端不喜欢发行者 ID:“ 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": "anuj@techmorphosis.com",
"iat": "1477398958",
"exp": "1477402558",
"name": "Anuj Mody",
"given_name": "Anuj",
"family_name": "Mody",
"locale": "en",
"alg": "RS256",
"kid": "XXXXXXXXXXXX"
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
308 次 |
| 最近记录: |