What I'm trying to do:
For the UWP app that I'm developing, I'm requiring the users to login with their Google/FB credentials to access the features of the app. To do this, I'm using an Auth0 client for OAuth authentication. On successful login, the user should be navigated to MainPage.xaml. When debugging the app, this works perfectly with no problems at all.
XAML:
<Button Margin="0,45,0,0" Grid.Row="6" HorizontalAlignment="Center" Name="GoogleSignIn" Content="Sign in with Google+" Tag="google-oauth2" Click="OAuthSignin" />
<Button Margin="0,15,0,0" Grid.Row="7" HorizontalAlignment="Center" Name="FacebookSignIn" Content="Sign in with Facebook" Tag="facebook" Click="OAuthSignin" />
Code-behind:
private async void OAuthSignin(object sender, RoutedEventArgs e)
{
string oauthprovider = ((Button)sender).Tag.ToString();
try
{
Auth0User user = await App.auth0.LoginAsync(oauthprovider);
if (user != null)
{
//Add user to credential locker
}
}
catch(Exception ex)
{
ex.ToString();
}
finally
{
var nav = Template10.Common.BootStrapper.Current.NavigationService;
nav.Navigate(typeof(Views.MainPage));
nav.ClearHistory();
}
}
What's going wrong:
Since the app gets deployed to the emulator, I stop debugging and launch the app by tapping the tile. I get to the login page, enter my credentials. As soon as I hit enter, I see it returning back to the login page and crashing soon after. If I re-open the app this point, I see that I'm already logged in and it takes me directly to MainPage.xaml (as is the logic of the app)
What concerns me: Why is it behaving differently when not in debug mode? This handicaps me because I can't put a breakpoint to determine what caused the crash.
Any input would be greatly appreciated.
P.S: I've tried deploying the app to me Lumia 640 and I see the same problem on the phone as well (meaning to say it's not emulator related). The desktop version works fine (even outside of debugging).