summaryrefslogtreecommitdiffstats
path: root/samples/OAuthClient/GoogleApps2Legged.aspx.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2011-06-27 06:33:04 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2011-06-27 06:33:04 -0700
commitd292f3c42ad8f209d6a67b872c1a1dff18e45d43 (patch)
tree2893562ab2b20c16ee0f043fa6e7da210e5a013e /samples/OAuthClient/GoogleApps2Legged.aspx.cs
parent1498e4d316838850cbfc40628c70b20b108e340b (diff)
downloadDotNetOpenAuth-d292f3c42ad8f209d6a67b872c1a1dff18e45d43.zip
DotNetOpenAuth-d292f3c42ad8f209d6a67b872c1a1dff18e45d43.tar.gz
DotNetOpenAuth-d292f3c42ad8f209d6a67b872c1a1dff18e45d43.tar.bz2
Fixed bad merge.
Diffstat (limited to 'samples/OAuthClient/GoogleApps2Legged.aspx.cs')
-rw-r--r--samples/OAuthClient/GoogleApps2Legged.aspx.cs39
1 files changed, 39 insertions, 0 deletions
diff --git a/samples/OAuthClient/GoogleApps2Legged.aspx.cs b/samples/OAuthClient/GoogleApps2Legged.aspx.cs
new file mode 100644
index 0000000..afb156b
--- /dev/null
+++ b/samples/OAuthClient/GoogleApps2Legged.aspx.cs
@@ -0,0 +1,39 @@
+namespace OAuthConsumer {
+ using System;
+ using System.Collections.Generic;
+ using System.Configuration;
+ using System.Linq;
+ using System.Web;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
+ using DotNetOpenAuth.ApplicationBlock;
+ using DotNetOpenAuth.Messaging;
+ using DotNetOpenAuth.OAuth;
+ using DotNetOpenAuth.OAuth.Messages;
+
+ public partial class GoogleApps2Legged : System.Web.UI.Page {
+ private InMemoryTokenManager TokenManager {
+ get {
+ var tokenManager = (InMemoryTokenManager)Application["GoogleTokenManager"];
+ if (tokenManager == null) {
+ string consumerKey = ConfigurationManager.AppSettings["googleConsumerKey"];
+ string consumerSecret = ConfigurationManager.AppSettings["googleConsumerSecret"];
+ if (!string.IsNullOrEmpty(consumerKey)) {
+ tokenManager = new InMemoryTokenManager(consumerKey, consumerSecret);
+ Application["GoogleTokenManager"] = tokenManager;
+ }
+ }
+
+ return tokenManager;
+ }
+ }
+
+ protected void Page_Load(object sender, EventArgs e) {
+ var google = new WebConsumer(GoogleConsumer.ServiceDescription, this.TokenManager);
+ string accessToken = google.RequestNewClientAccount();
+ ////string tokenSecret = google.TokenManager.GetTokenSecret(accessToken);
+ MessageReceivingEndpoint ep = null; // set up your authorized call here.
+ google.PrepareAuthorizedRequestAndSend(ep, accessToken);
+ }
+ }
+} \ No newline at end of file