diff --git a/Owin.Security.Providers/GooglePlus/GooglePlusAuthenticationHandler.cs b/Owin.Security.Providers/GooglePlus/GooglePlusAuthenticationHandler.cs
index 03981cf..2c99b38 100644
--- a/Owin.Security.Providers/GooglePlus/GooglePlusAuthenticationHandler.cs
+++ b/Owin.Security.Providers/GooglePlus/GooglePlusAuthenticationHandler.cs
@@ -188,12 +188,14 @@ namespace Owin.Security.Providers.GooglePlus
"&scope=" + Uri.EscapeDataString(scope) +
"&state=" + Uri.EscapeDataString(state);
+ // Check if offline access was requested
if (Options.RequestOfflineAccess)
authorizationEndpoint += "&access_type=offline";
- //"&request_visible_actions=http://schemas.google.com/AddActivity" +
- //"&approval_prompt=force" +
- //"&include_granted_scopes=true"
- ;
+
+ // Request the moment types
+ if (Options.MomentTypes.Count > 0)
+ authorizationEndpoint += String.Format("&request_visible_actions={0}",
+ String.Join(" ", Options.MomentTypes));
Response.Redirect(authorizationEndpoint);
}
diff --git a/Owin.Security.Providers/GooglePlus/GooglePlusAuthenticationOptions.cs b/Owin.Security.Providers/GooglePlus/GooglePlusAuthenticationOptions.cs
index 8b726aa..a71da12 100644
--- a/Owin.Security.Providers/GooglePlus/GooglePlusAuthenticationOptions.cs
+++ b/Owin.Security.Providers/GooglePlus/GooglePlusAuthenticationOptions.cs
@@ -63,6 +63,12 @@ namespace Owin.Security.Providers.GooglePlus
///
public string ClientSecret { get; set; }
+ ///
+ /// The list of moment types which you application wants to write. During authentication this will be passed through via the request_visible_actions parameter.
+ /// For more information of the moment types you may request, see https://developers.google.com/+/api/moment-types/
+ ///
+ public IList MomentTypes { get; private set; }
+
///
/// Gets or sets the used in the authentication events
///
@@ -98,6 +104,7 @@ namespace Owin.Security.Providers.GooglePlus
Caption = Constants.DefaultAuthenticationType;
CallbackPath = new PathString("/signin-googleplus");
AuthenticationMode = AuthenticationMode.Passive;
+ MomentTypes = new List();
Scope = new List
{
"https://www.googleapis.com/auth/plus.login",
diff --git a/OwinOAuthProvidersDemo/App_Start/Startup.Auth.cs b/OwinOAuthProvidersDemo/App_Start/Startup.Auth.cs
index 254f80b..77879db 100644
--- a/OwinOAuthProvidersDemo/App_Start/Startup.Auth.cs
+++ b/OwinOAuthProvidersDemo/App_Start/Startup.Auth.cs
@@ -50,17 +50,22 @@ namespace OwinOAuthProvidersDemo
//app.UseGitHubAuthentication("", "");
- var options = new GooglePlusAuthenticationOptions
- {
- ClientId = "",
- ClientSecret = "",
- RequestOfflineAccess = true,
- Provider = new GooglePlusAuthenticationProvider
- {
- OnAuthenticated = async context => System.Diagnostics.Debug.WriteLine(String.Format("Refresh Token: {0}", context.RefreshToken))
- }
- };
- app.UseGooglePlusAuthentication(options);
+
+ //var options = new GooglePlusAuthenticationOptions
+ //{
+ // ClientId = "",
+ // ClientSecret = "",
+ // RequestOfflineAccess = true,
+ // Provider = new GooglePlusAuthenticationProvider
+ // {
+ // OnAuthenticated = async context => System.Diagnostics.Debug.WriteLine(String.Format("Refresh Token: {0}", context.RefreshToken))
+ // }
+ //};
+ //options.MomentTypes.Add("http://schemas.google.com/AddActivity");
+ //options.MomentTypes.Add("http://schemas.google.com/CheckInActivity");
+ //options.MomentTypes.Add("http://schemas.google.com/BuyActivity");
+ //app.UseGooglePlusAuthentication(options);
+
//app.UseOpenIDAuthentication("http://me.yahoo.com/", "Yahoo");