我遇到了一个奇怪的错误。通过社交提供程序进行身份验证时,应该是MobileServiceClient错误。我和谷歌这个特殊问题只有谷歌。
起初,我正在
Error: The POST Google login request must contain an id_token in the body of the request.
将我的JObject KeyValuePair从access_token更改为id_token后,我收到此错误
Error: Invalid token format. Expected Envelope.Claims.Signature.
这是我的代码:
jO = new JObject();
jO.Add("id_token", accessToken);
user = await client.LoginAsync(MobileServiceAuthenticationProvider.Google, jO);
答案 0 :(得分:0)
问题已解决。 Azure移动服务API文档过时。
对于Google oauth提供程序,JObject不使用access_token的namevaluepair,而是使用id_token。从令牌端点检索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);