private void btnLogin_Click(object sender, EventArgs e)
        {
            string client_id = "CLIENT_ID";
            string client_secret = "CLIENT_SECRET";

            /* Tokenları Saklayıp her seferinde giriş yapmadan kullanabilirsiniz */

            if (tokensPresentInDb())
            {
                /* Eğer tokenlar saklandıysa */
                string access_token = getAccessTokenFromDb();
                string refresh_token = getRefreshTokenFromDb();

                Token tkn = new Token(access_token, refresh_token);
                BulutfonWinClient client = new BulutfonWinClient(client_id, client_secret);
                tkn.TokenExpired += client.tokenProviderTokenExpired;
                Authentication.Token = tkn;
                showCallPanel(true);
            }
            else
            {
                /* Baştan token al */
                var loggedIn = LoginForm.Login(client_id, client_secret, this);
                showCallPanel(loggedIn);
            }
        }
Ejemplo n.º 2
0
        public static void RegisterAuth()
        {
            // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
            // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166

            //OAuthWebSecurity.RegisterMicrosoftClient(
            //    clientId: "",
            //    clientSecret: "");

            //OAuthWebSecurity.RegisterTwitterClient(
            //    consumerKey: "",
            //    consumerSecret: "");

            //OAuthWebSecurity.RegisterFacebookClient(
            //    appId: "",
            //    appSecret: "");

            //OAuthWebSecurity.RegisterGoogleClient();

            TokenRefreshCallback refreshCallback = new TokenRefreshCallback(tokenRefreshed);

            BulutfonWebClient client = new BulutfonWebClient(
                clientId: "CLIENT_ID",
                clientSecret: "CLIENT_SECRET", refreshCallback: refreshCallback);

            OAuthWebSecurity.RegisterClient(client, "Bulutfon", null);

            Token tkn = new Token("a", "b");
            tkn.RefreshCallback += tokenRefreshed;

        }
Ejemplo n.º 3
0
 private void button2_Click(object sender, EventArgs e)
 {
     // With Master Token
     button1.Enabled = false;
     button2.Enabled = false;
     Token token = new Token("MASTER TOKEN", "");
     dataGridView1.DataSource = BulutfonApi.GetDids(token);
 }