コード例 #1
0
 private void InitializeWebServerClient()
 {
     var authorizationServerUri = new Uri(Paths.AuthorizationServerBaseAddress);
     var authorizationServer = new DotNetOpenAuth.OAuth2.AuthorizationServerDescription
     {
         AuthorizationEndpoint = new Uri(authorizationServerUri, Paths.AuthorizePath),
         TokenEndpoint = new Uri(authorizationServerUri, Paths.TokenPath)
     };
     _webServerClient = new DotNetOpenAuth.OAuth2.WebServerClient(authorizationServer, Clients.Client1.Id, Clients.Client1.Secret);
 }
コード例 #2
0
        public void btnAuthenticate_Click()
        {
            string client_id   = "db0fb443b68995eb89d8152e4a5c779f7f5918ab";
            string redirectURI = "http://localhost:54210/Home/Index";
            string reqToken    = "https://launchpad.37signals.com/authorization/token?type=web_server&client_id={0}&redirect_uri={1}&client_secret={2}&code={3}";

            var server = new DotNetOpenAuth.OAuth2.AuthorizationServerDescription();

            server.AuthorizationEndpoint = new Uri("https://launchpad.37signals.com/authorization/new?type=web_server&client_id={0}&redirect_uri={1}");
            server.TokenEndpoint         = new Uri(reqToken);
            var client = new DotNetOpenAuth.OAuth2.WebServerClient(server, client_id, redirectURI);

            client.RequestUserAuthorization(returnTo: new Uri(redirectURI));
        }