public void MyGovWebBrowserLoadComplete(object obj) { Uri UriString = this.MyGovBrowserViewModel.NavigatedUri; if (UriString.OriginalString.StartsWith("https://localhost/oauth_callback?")) { if (UriString.OriginalString.Contains('?')) { string[] QuerySplit = UriString.Query.Split('?'); string ParameterCodeValue = MyHRMobile.Common.Utility.HttpTools.GetQueryParameter(QuerySplit[1], "code"); if (!string.IsNullOrWhiteSpace(ParameterCodeValue)) { UiService.CurrectUserAccount = new DataStore.UserAccount(); UiService.CurrectUserAccount.AuthorisationCode = ParameterCodeValue.Trim(); UiService.CurrectUserAccount.Username = this.AddUserAccountViewModel.UserAccountNameText; if (UiService.GetAccessToken()) { this.AddUserAccountViewList = ConvertToUserAccountViewList(UiService.ApplicationStore.UserList); //this.CurrentUserAccount = ConvertToUserAccountView(UiService.ApplicationStore.UserList.SingleOrDefault(x => x.Username == UiService.CurrectUserAccount.Username)); DropRightPanel(); ReportMyGovLoginOutcome(true); } } else { //Cancel //https://localhost/oauth_callback?error=invalid_grant&error_description=Authentication+cancelled+by+user string ParameterErrorValue = MyHRMobile.Common.Utility.HttpTools.GetQueryParameter(QuerySplit[1], "error"); if (!string.IsNullOrWhiteSpace(ParameterErrorValue)) { this.MyGovError = ParameterErrorValue; var ErrorDescription = MyHRMobile.Common.Utility.HttpTools.GetQueryParameter(QuerySplit[1], "error_description"); if (!string.IsNullOrWhiteSpace(ErrorDescription)) { this.MyGovErrorDescription = ErrorDescription; } ReportMyGovLoginOutcome(false); } } } } else if (UriString.OriginalString.StartsWith("https://apinams.ehealthvendortest.health.gov.au/api/oauth/ams.ehealthvendortest.health.gov.au/api/oauth/authorize??")) { //Cancel from Secret Question //https://apinams.ehealthvendortest.health.gov.au/api/oauth/ams.ehealthvendortest.health.gov.au/api/oauth/authorize??error=invalid_grant&error_description=Authentication+cancelled+by+user if (UriString.OriginalString.Contains('?')) { string[] QuerySplit = UriString.Query.Split('?'); if (QuerySplit.Count() == 3) { string Query = QuerySplit[2]; string ParameterErrorValue = MyHRMobile.Common.Utility.HttpTools.GetQueryParameter(Query, "error"); if (!string.IsNullOrWhiteSpace(ParameterErrorValue)) { this.MyGovError = ParameterErrorValue; var ErrorDescription = MyHRMobile.Common.Utility.HttpTools.GetQueryParameter(Query, "error_description"); if (!string.IsNullOrWhiteSpace(ErrorDescription)) { this.MyGovErrorDescription = ErrorDescription; } ReportMyGovLoginOutcome(false); } else { this.MyGovError = $"Unknown Error"; this.MyGovErrorDescription = $"URL was: {UriString.OriginalString}"; ReportMyGovLoginOutcome(false); } } else { this.MyGovError = $"Unknown Error"; this.MyGovErrorDescription = $"URL was: {UriString.OriginalString}"; ReportMyGovLoginOutcome(false); } } else { this.MyGovError = $"Unknown Error"; this.MyGovErrorDescription = $"URL was: {UriString.OriginalString}"; ReportMyGovLoginOutcome(false); } } }