I'm hitting an error that is weird. It should be MobileServiceClient error when authenticating through social provider. I've this particular problem with Google and only 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
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 .
The JObject doesn't use namevaluepair of access_token for Google oauth provider, instead it uses 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.
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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.