// This button gets enabled if the HTTP request for the request token succeeded private void authorizeTokenBtn_Click(object sender, RoutedEventArgs e) { if (oobCheckBox.IsChecked == false) { // For in band authorization build URL for Authorization HTTP request RestRequest authorizeRequest = new RestRequest { Resource = "OAuth/Authorize", }; authorizeRequest.AddParameter("viewmode", "desktop"); authorizeRequest.AddParameter("oauth_token", m_oAuthReqToken); Uri authorizeUri = m_Client.BuildUri(authorizeRequest); // Launch another window with browser control and navigate to the Authorization URL BrowserAuthenticate frm = new BrowserAuthenticate(); frm.Uri = authorizeUri; if (frm.ShowDialog() != true) { logOutput.AppendText("In band Authorization failed" + "\n" + "-----------------------" + "\n"); m_Client = null; authorizeTokenBtn.IsEnabled = false; acssTokenBtn.IsEnabled = false; refreshTokenBtn.IsEnabled = false; invalidateButton.IsEnabled = false; pinTxt.Text = ""; return; } logOutput.AppendText("In band Authorization succeeded" + "\n" + "-----------------------" + "\n"); } else { //This is for Out of band Authorization, Build Authorization HTTP URL var request = new RestRequest("OAuth/Authorize"); request.AddParameter("oauth_token", m_oAuthReqToken); Uri authorizeUri = m_Client.BuildUri(request); var url = authorizeUri.ToString(); logOutput.AppendText("Requesting Out of band Authorization PIN" + "\n" + "-----------------------" + "\n"); //Launch default browser with authorization URL Process.Start(url); //User logs into Oxygen and clicks 'authorize' button //Browser displays PIN pinTxt.IsEnabled = true; } acssTokenBtn.IsEnabled = true; }