Google OAuth2 Demonstration v1.0

This is an example application implementing Google OAuth2 authentication for a C# web application. This software is provided AS IS by A Better Geek and is solely for testing purposes. Please remember to test all code thoroughly in your own application before moving to production.

Some notes:


<% if (Request.Cookies["client_id"] == null && Request.Form["client_id"] == null && Session["loggedin"] != "yes") { %>

You are seeing this message because you have not configured the application yet. Setting the below parameters will create local browser cookies storing each parameter. In order to protect your application's client secret, please remember to clear the cookies for this page when you are done testing!

If you haven't already done so, you need to first go to Google's API Console and create your application. Note down your client id and client secret for use in the below form. You also need to use the URL of this page, including the port number for localhost, as the redirect URI for your application.

<% } else if (Request.Cookies["client_id"] == null && Request.Form["client_id"] != null) { %> <% //write POSTDATA to cookies Response.Cookies["client_id"].Value = Request.Form["client_id"]; Response.Cookies["client_secret"].Value = Request.Form["client_secret"]; Response.Cookies["redirect_uri"].Value = Request.Form["redirect_uri"]; Response.Redirect(Request.Form["redirect_uri"]); %> <% } else { %>