summaryrefslogtreecommitdiffstats
path: root/samples/OAuthConsumer/GoogleApps2Legged.aspx.cs
blob: 52cc88595dca266c7ccebad4b4a813a29a49c32d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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 {
		protected void Page_Load(object sender, EventArgs e) {
			this.RegisterAsyncTask(
				new PageAsyncTask(
					async ct => {
						var google = new GoogleConsumer();
						var accessToken = await google.RequestNewClientAccountAsync();
						using (var httpClient = google.CreateHttpClient(accessToken.AccessToken)) {
							await httpClient.GetAsync("http://someUri", Response.ClientDisconnectedToken);
						}
					}));
		}

		protected void getAddressBookButton_Click(object sender, EventArgs e) {
			throw new NotImplementedException();
		}
	}
}