/// <summary> /// /// </summary> /// <param name="tokens"></param> public FavoriteActions(OAuthTokens tokens) : base(tokens) { if (tokens == null) { throw new ArgumentNullException("tokens"); } }
public TwitterUserActions(OAuthTokens tokens) : base(tokens) { if (tokens == null) { throw new ArgumentNullException("tokens"); } }
private void btnSignIn_Click(object sender, EventArgs e) { string requestToken = OAuthUtility.GetRequestToken().Token; Uri authenticationUri = OAuthUtility.BuildAuthorizationUri(requestToken); Process.Start(authenticationUri.AbsoluteUri); OAuthDialog dialog = new OAuthDialog(requestToken); dialog.ShowDialog(this); if (dialog.isAuth) { //user is authenticated this.Tokens = dialog.Tokens; btnSignIn.Enabled = false; btnTweet.Enabled = true; txtTweet.Enabled = true; } }
private void btnOk_Click(object sender, EventArgs e) { if(!String.IsNullOrEmpty(txtPIN.Text)) { OAuthTokens tokens = new OAuthTokens(); OAuthTokenResponse accessTokenResponse = OAuthUtility.GetAccessToken(this.RequestToken,txtPIN.Text); if (accessTokenResponse != null) { tokens.AccessToken = accessTokenResponse.Token; tokens.AccessTokenSecret = accessTokenResponse.TokenSecret; this.Tokens = tokens; this.isAuth = true; this.Close(); } else this.isAuth = false; } }
protected void Page_Load(object sender, EventArgs e) { OAuthTokens tokens = new OAuthTokens(); OAuthTokenResponse accessTokenResponse = OAuthUtility.GetAccessToken(); if (accessTokenResponse != null) { tokens.AccessToken = accessTokenResponse.Token; tokens.AccessTokenSecret = accessTokenResponse.TokenSecret; Session.Add("OAuthTokenResponse", accessTokenResponse); Session.Add("OAuthTokens", tokens); Response.Redirect("Default.aspx?action=logged"); } else { Response.Redirect("Default.aspx?action=noLogged"); } }
/// <summary> /// Initializes a new instance of the WebRequestBuilder class. /// </summary> /// <param name="requestUri">The request URI.</param> /// <param name="Verb">The Verb.</param> /// <param name="Tokens">The Tokens.</param> /// <param name="userAgent">The user agent.</param> public WebRequestBuilder(Uri requestUri, HTTPVerb verb, OAuthTokens tokens, string userAgent = "") : this(requestUri, verb, userAgent, null) { this.Tokens = tokens; if (tokens != null) { if (string.IsNullOrEmpty(this.Tokens.ConsumerKey) || string.IsNullOrEmpty(this.Tokens.ConsumerSecret)) { throw new ArgumentException("Consumer key and secret are required for OAuth requests."); } if (string.IsNullOrEmpty(this.Tokens.AccessToken) ^ string.IsNullOrEmpty(this.Tokens.AccessTokenSecret)) { throw new ArgumentException("The access token is invalid. You must specify the key AND secret values."); } this.UseOAuth = true; } }