Reputation: 395
I'm working on a Xamarin.Forms project, and I'm having a really weird issue. This code is actually executing in Xamarin.Droid project.
When I try to do this
var user = await client.LoginAsync(this, MobileServiceAuthenticationProvider.Facebook);
if (user != null)
{
try
{
// executes this line
var userInfo = await client.InvokeApiAsync("/.auth/me");
// down here nothing is executed and userInfo is never set with the data
}
catch (Exception e)
{
// never enter to this block
}
}
The userInfo variable is never set with the data, and no exceptions and nothing rare in the Output.
I already tried client.InvokeApiAsync("/.auth/me", HttpMethod.Get, null) but no works neither.
I know this is quite short information but I haven't anything else, because no exception is raised.
Thanks.
Upvotes: 0
Views: 93
Reputation: 395
I finally figured out what was the problem. The event handler that initiates the logic of authentication, returned void
instead of Task
, so the async call never continues after await
call.
This is something for remind.
Thanks @Amor - MSFT for your answer.
Upvotes: 0
Reputation: 8491
I followed this article to add authentication to my Xamarin Forms app. It worked fine on my side. There are some things you need to check on your project.
Upvotes: 1