Reputation: 1
I am trying to use Google Authentication in my Xamarin Forms app by using Xamarin.Auth to perform client-side authentication and then passing the received token to my Azure App Service custom website back-end that is configured to use Google Authentication.
I get the tokens back from Xamarin.Auth on the client just fine. However, when I try to use the MobileServiceClient's LoginAsync method, I get an Exception that says:
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
I found this post: Xamarin MobileServiceClient RefreshUserAsync with Google 403 , in which rleffler apparently has this working, but I don't think I can direct message him.
Here is my code calling LoginAsync:
MobileServiceClient client = new
MobileServiceClient("http://<mywebsite>.azurewebsites.net");
var zumoPayload = new JObject();
zumoPayload["access_token"] = accessToken;
zumoPayload["id_token"] = idToken;
if (user == null)
{
string message;
try
{
user = await client.LoginAsync(MobileServiceAuthenticationProvider.Google, zumoPayload);
message = string.Format("You are now logged in - {0}", user.UserId);
}
catch (Exception ex)
{
//This is where I catch the JsonReaderException
message = "You must log in. Login Required";
}
}
Upvotes: 0
Views: 236