Attempting to set up a Xamarin.Forms app that uses Auth 0. I’m new to both.
The example source code for Xamarin is only for native apps, so I’m having to adapt it. Here is my method:
public async Task<UserAccount> GetAccessToken()
{
Console.WriteLine("Connecting...");
LoginResult loginResult = null;
try
{
loginResult = await _auth0.LoginAsync();
}
catch (TaskCanceledException)
{
Console.WriteLine("User cancelled out of login, going back to main page.");
}
if (loginResult == null)
return null;
if (loginResult.IsError)
{
Console.WriteLine($"An error occurred during login: {loginResult.Error}");
return null;
}
UserAccount result = new UserAccount()
{
AccessToken = loginResult.AccessToken,
UserId = loginResult.IdentityToken
};
Console.WriteLine(result.AccessToken);
Console.WriteLine(result.UserId);
MessagingCenter.Send<UserAccount>(result, ChannelName.LOGIN_SUCCESS);
return result;
}
}
I am only seeing Connected… in the log.
I wired up an intent as described. Here it is.
base.OnNewIntent(intent);
Console.WriteLine("Intent received:", intent.DataString);
Auth0.OidcClient.ActivityMediator.Instance.Send(intent.DataString);
UserAccount userAccount = new UserAccount() {
AccessToken = intent.DataString
};
MessagingCenter.Send<UserAccount>(userAccount, ChannelName.LOGIN_SUCCESS);
Still nothing in the log. It returns to the sign in screen it left from to open the Auth0 sign in page.
Out of things I can think to try. Ideas what is going on?