简体   繁体   English

ASP.NET MobileServiceClient上的Azure移动服务Google身份验证错误

[英]Azure Mobile Services on ASP.NET MobileServiceClient Google Authentication Error

I'm hitting an error that is weird. 我遇到一个奇怪的错误。 It should be MobileServiceClient error when authenticating through social provider. 通过社交提供程序进行身份验证时,应该是MobileServiceClient错误。 I've this particular problem with Google and only Google. 我和Google都有这个特别的问题,只有Google。

At first, I'm getting 首先,我要

Error: The POST Google login request must contain an id_token in the body of the request.

After I change my JObject KeyValuePair from access_token to id_token, I'm getting this error 将JObject KeyValuePair从access_token更改为id_token后,出现此错误

Error: Invalid token format. Expected Envelope.Claims.Signature.

This is my code: 这是我的代码:

jO = new JObject();
jO.Add("id_token", accessToken);
user = await client.LoginAsync(MobileServiceAuthenticationProvider.Google, jO);

Problem fixed. 问题已解决。 Azure Mobile Services API documentation was outdated . Azure移动服务API文档已过时

The JObject doesn't use namevaluepair of access_token for Google oauth provider, instead it uses id_token. JObject不为Google oauth提供者使用access_token的namevaluepair,而是使用id_token。 When you retrieve the access_token from the token endpoint, you will need to read the id_token value and then uses it for the Azure Mobile Services Client .LoginAsync() method. 从令牌终结点检索access_token时,将需要读取id_token值,然后将其用于Azure移动服务客户端.LoginAsync()方法。

JObject jO = new JObject();
jO.Add("id_token", googleToken.id_token);
// googleToken is my own custom class for handling the json response from Google Token endpoint
user = await client.LoginAsync(MobileServiceAuthenticationProvider.Google, jO);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM