コード例 #1
0
ファイル: DiscogsAuth.cs プロジェクト: MediaPortal/MPTagThat
 public string RegenerateHeaders(string token, string token_secret)
 {
     OAuth = new OAuth.Manager(_ConsumerKey,_ConsumerSecret,token,token_secret);
     var search = "http://api.discogs.com/oauth/identity";
     var authHeader = OAuth.GenerateAuthzHeader(search, "GET");
     return authHeader;
 }
コード例 #2
0
        public string RegenerateHeaders(string token, string token_secret)
        {
            OAuth = new OAuth.Manager(_ConsumerKey, _ConsumerSecret, token, token_secret);
            var search     = "http://api.discogs.com/oauth/identity";
            var authHeader = OAuth.GenerateAuthzHeader(search, "GET");

            return(authHeader);
        }
コード例 #3
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     var oauth = new OAuth.Manager();
     // the URL to obtain a temporary "request token"
     var rtUrl = "https://accounts.google.com/o/oauth2/token";
     oauth["consumer_key"] = "1005536550939-0jf0eb3mpr1c43renc88ikg9i8msjolk.apps.googleusercontent.com";
     oauth["consumer_secret"] = "jEjPfYRWzTNyldQRzYYmJzGP";
     //oauth.AcquireRequestToken(rtUrl, "POST");
 }
コード例 #4
0
ファイル: DiscogsAuth.cs プロジェクト: MediaPortal/MPTagThat
 public string AuthenticateUser()
 {
     OAuth = new OAuth.Manager();
     OAuth["consumer_key"] = _ConsumerKey;
     OAuth["consumer_secret"] = _ConsumerSecret;
     OAuthResponse requestToken = OAuth.AcquireRequestToken("http://api.discogs.com/oauth/request_token", "POST", _UserAgent);
     string url = "http://www.discogs.com/oauth/authorize?oauth_token=" + OAuth["token"];
     return url;
 }
コード例 #5
0
        public string AuthenticateUser()
        {
            OAuth = new OAuth.Manager();
            OAuth["consumer_key"]    = _ConsumerKey;
            OAuth["consumer_secret"] = _ConsumerSecret;
            OAuthResponse requestToken = OAuth.AcquireRequestToken("http://api.discogs.com/oauth/request_token", "POST", _UserAgent);
            string        url          = "http://www.discogs.com/oauth/authorize?oauth_token=" + OAuth["token"];

            return(url);
        }
コード例 #6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //http://deanhume.com/home/blogpost/a-simple-guide-to-using-oauth-with-c-/49

            var oauth = new OAuth.Manager();
            // the URL to obtain a temporary "request token"
            var rtUrl = "https://api.twitter.com/oauth/request_token";
            oauth["consumer_key"] = "Frank";
            oauth["consumer_secret"] = "Frank";
            //oauth.AcquireRequestToken(rtUrl, "POST");
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: Divra/Tellstick
        public Form1()
        {
            InitializeComponent();

            m = new Manager();
            m["consumer_key"] = ConfigurationManager.AppSettings["consumer_key"];
            m["consumer_secret"] = ConfigurationManager.AppSettings["consumer_secret"];

            m["token"] = ConfigurationManager.AppSettings["token"];
            m["token_secret"] = ConfigurationManager.AppSettings["token_secret"];

            UpdateDevices();
            tmrUpdateDevices.Start();
        }
コード例 #8
0
        public async Task<bool?> Init(MetroWindow win)
        {
            try
            {
                parentWindow = win as MainWindow;

                authMgr = new Manager();
                authMgr["consumer_key"] = ConsumerKey;
                authMgr["consumer_secret"] = ConsumerSecret;
                authMgr.AcquireRequestToken(RequestTokenURL, "POST");
                MetroDialogSettings settings = new MetroDialogSettings()
                {
                    AnimateHide = true,
                    AnimateShow = true,
                    AffirmativeButtonText = "확인",
                    NegativeButtonText = "종료"
                };

                MessageDialogResult result = await DialogManager.ShowMessageAsync(parentWindow, "인증", "인증을 위해 웹브라우저를 통해 트위터에 로그인합니다.",
                    MessageDialogStyle.AffirmativeAndNegative, settings);

                if (result == MessageDialogResult.Affirmative)
                {
                    System.Diagnostics.Process.Start($"{RequestPinURL}{authMgr["token"]}");
                    settings = new MetroDialogSettings()
                    {
                        AnimateHide = true,
                        AnimateShow = true,
                        AffirmativeButtonText = "인증",
                        NegativeButtonText = "취소 및 종료"
                    };
                    
                    string pin = await DialogManager.ShowInputAsync(parentWindow, "PIN", "웹브라우저 상에 표시된 PIN을 입력합니다.", settings);

                    try
                    {
                        authMgr.AcquireAccessToken(AccessTokenURL, "POST", pin);
                    }
                    catch(Exception ex)
                    {
                        parentWindow.Close();
                    }

                    IsInit = true;

                    // Get Screen Name
                    dynamic obj = await GetJson("https://api.twitter.com/1.1/account/settings.json", "GET");
                    string name = obj.screen_name;

                    // GetProfile
                    dynamic json = await GetJson($"https://api.twitter.com/1.1/users/show.json?screen_name={name}", "GET");
                    parentWindow.UserNameBlock.Text = json.name;
                    parentWindow.ScreenNameBlock.Text = $"@{json.screen_name}";
                    parentWindow.ProfileDescBlock.Text = json.description;
                    string imageUrl = json.profile_image_url;
                    ProfileImage = new BitmapImage();
                    ProfileImage.BeginInit();
                    ProfileImage.UriSource = new Uri(imageUrl.Replace("_normal", ""));
                    ProfileImage.DownloadCompleted +=
                        (s, ev) => OnPropertyChanged("ProfileImage");
                    ProfileImage.EndInit();
                }
                else
                {
                    parentWindow.Close();
                }

                return IsInit;
            }
            catch (Exception e)
            {
                await DialogManager.ShowMessageAsync(parentWindow, "Error", $"= Message{e.Message}\n\n= Stack Trace\n{e.StackTrace}");
                IsInit = false;
                return false;
            }
        }
コード例 #9
0
ファイル: GimmieWrapper.cs プロジェクト: keang/unity
 public static void InitGimmie(string key, string secret)
 {
     if(instance==null) instance = new GimmieWrapper(key, secret);
     mOAuthManger = new OAuth.Manager(key, secret,"","");
 }