/** * In this function we firstly load the auth pin authorizer with the application credentials. * We also load the login twitter page in order to obtain the pin. */ void OAuthPage_Loaded(object sender, RoutedEventArgs e) { //Auth definition with our application credentials auth = new PinAuthorizer { Credentials = new InMemoryCredentials { ConsumerKey = Constants.getConsumerKey(), ConsumerSecret = Constants.getConsumerSecret() }, UseCompression = true, //Browser authentication webpage GoToTwitterAuthorization = pageLink => Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => OAuthWebBrowser.Navigate(new Uri(pageLink, UriKind.Absolute))) }; auth.BeginAuthorize(resp => Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { switch (resp.Status) { case TwitterErrorStatus.Success: break; case TwitterErrorStatus.RequestProcessingException: case TwitterErrorStatus.TwitterApiError: //new MessageDialog(resp.Error.ToString(), resp.Message).ShowAsync(); break; } })); }
void OAuthForm_Load(object sender, EventArgs e) { OAuthWebBrowser.Navigate(new Uri( string.Format( "https://api.twitch.tv/kraken/oauth2/authorize?response_type=token&client_id={0}&redirect_uri={1}&scope={2}", Twitch.ClientId, RedirectUrl, "channel_editor+chat_login+channel_subscriptions"), UriKind.Absolute)); }
public OAuthWindowView(IStreamingService streamingService, IConfigHandler configHandler) { InitializeComponent(); this.streamingService = streamingService ?? throw new ArgumentNullException(nameof(streamingService)); this.configHandler = configHandler ?? throw new ArgumentNullException(nameof(configHandler)); OAuthWebBrowser.Navigate(streamingService.OAuthUrl); OAuthWebBrowser.Navigated += OAuthWebBrowser_Navigated; }
void Page_Loaded(object sender, RoutedEventArgs e) { pinAuth = new PinAuthorizer { Credentials = new InMemoryCredentials { ConsumerKey = "", ConsumerSecret = "" }, UseCompression = true, GoToTwitterAuthorization = pageLink => Dispatcher.BeginInvoke(() => OAuthWebBrowser.Navigate(new Uri(pageLink, UriKind.Absolute))) }; this.pinAuth.BeginAuthorize(resp => Dispatcher.BeginInvoke(() => { switch (resp.Status) { case TwitterErrorStatus.Success: break; case TwitterErrorStatus.TwitterApiError: case TwitterErrorStatus.RequestProcessingException: MessageBox.Show( resp.Exception.ToString(), resp.Message, MessageBoxButton.OK); break; } })); // // comment out the code above and uncomment this code to use SingleUserAuthorizer // //var auth = new SingleUserAuthorizer //{ // Credentials = new SingleUserInMemoryCredentials // { // ConsumerKey = "", // twitter Consumer key // ConsumerSecret = "", // twitter Consumer secret // TwitterAccessToken = "", // twitter Access token // TwitterAccessTokenSecret = "" // twitter Access token secret // } //}; //SharedState.Authorizer = auth; //NavigationService.GoBack(); }
async void OAuthForm_Load(object sender, EventArgs e) { pinAuth = new PinAuthorizer { // Get the ConsumerKey and ConsumerSecret for your app and load them here. CredentialStore = new InMemoryCredentialStore { ConsumerKey = ConfigurationManager.AppSettings["consumerKey"], ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"] }, // Note: GetPin isn't used here because we've broken the authorization // process into two parts: begin and complete GoToTwitterAuthorization = pageLink => OAuthWebBrowser.Navigate(new Uri(pageLink, UriKind.Absolute)) }; await pinAuth.BeginAuthorizeAsync(); }
async void Page_Loaded(object sender, RoutedEventArgs e) { pinAuth = new PinAuthorizer { // Get the ConsumerKey and ConsumerSecret for your app and load them here. CredentialStore = new InMemoryCredentialStore { ConsumerKey = "", ConsumerSecret = "" }, // Note: GetPin isn't used here because we've broken the authorization // process into two parts: begin and complete GoToTwitterAuthorization = pageLink => Dispatcher.BeginInvoke( () => OAuthWebBrowser.Navigate(new Uri(pageLink, UriKind.Absolute))) }; await pinAuth.BeginAuthorizeAsync(); }
void OAuthForm_Load(object sender, EventArgs e) { auth = new WebAuthorizer { // Get the ConsumerKey and ConsumerSecret for your app and load them here. Credentials = new InMemoryCredentials { ConsumerKey = Twitter.ConsumerKey, ConsumerSecret = Twitter.ConsumerSecret }, Callback = new Uri("http://livesplit.org/twitter/"), // Note: GetPin isn't used here because we've broken the authorization // process into two parts: begin and complete PerformRedirect = pageLink => OAuthWebBrowser.Navigate(new Uri(pageLink, UriKind.Absolute)) }; auth.BeginAuthorization(new Uri("http://livesplit.org/twitter/")); }
void OAuthForm_Load(object sender, EventArgs e) { try { OAuthWebBrowser.Navigate(new Uri( string.Format( "https://id.twitch.tv/oauth2/authorize?response_type={0}&client_id={1}&redirect_uri={2}&scope={3}", TokenType, ClientId, RedirectUrl, Scope ), UriKind.Absolute )); } catch (Exception ex) { Log.Error(ex); } }
void OAuthForm_Load(object sender, EventArgs e) { OAuthWebBrowser.Navigate(new Uri("http://www.speedrun.com/api/auth")); }