Ejemplo n.º 1
0
        protected void linkBtn_Click(object sender, EventArgs e)
        {
            string state = OAuthHelper.InitState();

            Session["State"] = state;

            string url = OAuthHelper.GetAuthorizeUrl(System.Web.Configuration.WebConfigurationManager.AppSettings["RedirectUrl"], state);

            Response.Redirect(url);
        }
        protected void cmd_twitter_login_Click(object sender, EventArgs e)
        {
            OAuthHelper oauthhelper  = new OAuthHelper();
            string      requestToken = oauthhelper.GetRequestToken();

            if (string.IsNullOrEmpty(oauthhelper.oauth_error))
            {
                Response.Redirect(oauthhelper.GetAuthorizeUrl(requestToken));
            }
            else
            {
                Response.Write(oauthhelper.oauth_error);
            }
        }
Ejemplo n.º 3
0
        public async Task can_create_authorization_url()
        {
            var opts = new AuthorizeOptions
            {
                ClientId    = "YOUR_CLIENT_ID",
                RedirectUri = "YOUR_REDIRECT_URL",
                State       = "SECURE_RANDOM",
                Scope       = "wallet:accounts:read"
            };
            var authUrl = OAuthHelper.GetAuthorizeUrl(opts);

            var url =
                "https://www.coinbase.com/oauth/authorize?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URL&state=SECURE_RANDOM&scope=wallet%3Aaccounts%3Aread";


            var response = await authUrl.GetAsync();

            server.ShouldHaveExactCall(url);
        }
Ejemplo n.º 4
0
        public async Task test_full_flow_and_expiration()
        {
            //client.

            var opts = new AuthorizeOptions
            {
                ClientId    = secrets.OAuthClientId,
                RedirectUri = redirectUrl,
                State       = "random",
                Scope       = "wallet:accounts:read"
            };

            var authUrl = OAuthHelper.GetAuthorizeUrl(opts);

            authUrl.Dump();

            ("Execute the following URL and authorize the app. " +
             "Then, copy the callback?code=VALUE value to the secrets file.").Dump();
        }
 public TwitterAuthenticationModel()
 {
     _requestToken = _oau.GetRequestToken(Properties.Resources._api_twitter_consumer_key, Properties.Resources._api_twitter_consumer_secret);
     BrowserUri    = new Uri(_oau.GetAuthorizeUrl(_requestToken));
     Messenger.Default.Register <Uri>(this, GlobalConstant.MessageTwitterBrowserChangedURL, MyCallbackMethod);
 }
        protected void cmd_twitter_login_Click(object sender, EventArgs e)
        {
            OAuthHelper oauthhelper = new OAuthHelper();
            string requestToken = oauthhelper.GetRequestToken();

            if (string.IsNullOrEmpty(oauthhelper.oauth_error))
                Response.Redirect(oauthhelper.GetAuthorizeUrl(requestToken));
            else
                Response.Write(oauthhelper.oauth_error);
        }