private void Load() { try { OAuth2Helper authenticator = new OAuth2Helper("227H9T", "74e4a047fce979dd36a0edbd626c3939", "http://Miriot.suismoi.fr"); string[] scopes = new[] { "profile", "weight" }; string authUrl = authenticator.GenerateAuthUrl(scopes, null); WebView browser = new WebView(); browser.Height = 300; browser.Width = 300; browser.Source = new Uri(authUrl); browser.DefaultBackgroundColor = Colors.Black; MainGrid.Children.Add(browser); browser.NavigationStarting += async(s, args) => { if (args.Uri.OriginalString.Contains("code=")) { var code = args.Uri.Query.Replace("?code=", ""); AccessToken = await authenticator.ExchangeAuthCodeForAccessTokenAsync(code); AccessToken = await authenticator.RefreshToken(AccessToken.RefreshToken); MainGrid.Children.Remove(browser); try { var w = await GetWeightAsync(DateTime.Now, null); Value.Text = $"{w.Weight.First().Weight}kg"; } catch (Exception ex) { // Access denied ? Debug.WriteLine(ex.Message); } } }; } catch (Exception ex) { // Something went wrong Debug.WriteLine(ex.Message); } }