2

I am successfully using GoogleAuthorizationCodeFlow to obtain and store credentials to access the Google Calendar API. I would like to use the include_granted_scopes=true query parameter for incremental authorization.

I searched for a long time but could not figure out how to include the include_granted_scopes parameter. Is there a way to do so?

Cypress Frankenfeld
  • 2,317
  • 2
  • 28
  • 40
c0der
  • 18,467
  • 6
  • 33
  • 65

2 Answers2

1

First get your authorization url

GoogleAuthorizationCodeRequestUrl authUrl = googleAuthorizationCodeFlow.newAuthorizationUrl();

The authorization url is just an instance of a GenericUrl, so you can use GenericUrl.set(key, value) to set an arbitrary query parameter.

authUrl.set("include_granted_scopes", true);
Cypress Frankenfeld
  • 2,317
  • 2
  • 28
  • 40
0

Try the following:

var googleOAuthOptions = 
    new GoogleOAuth2AuthenticationOptions()
    {
        ClientId = "...",
        ClientSecret = "...",

        Provider = new GoogleOAuth2AuthenticationProvider
                    {
                        OnApplyRedirect = context =>
                        {
                            var redirect = context.RedirectUri;
                            redirect += "&include_granted_scopes=true";
                            context.Response.Redirect(redirect);

                        }
                    }
    };

googleOAuthOptions.Scope.Add(...);

app.UseGoogleAuthentication(googleOAuthOptions);