How to access Google Calendar API via ready Owin Authentication template in ASp.NET WebForms RRS feed

  • Question

  • User-1445957395 posted

    I am using following version.

    Microsoft Visual Studio Professional 2017
    Version 15.9.12
    Microsoft .NET Framework
    Version 4.8.03761

    I create a new "ASP.NET Web Application Project" ,  From ASP.NET 4.8 templates screen, I choose WebForms  , Under Authentication, I select "Individual User Accounts".

    This step create all the required template code ready for google authentication.  I set client id and secret key in Startup.Auth.cs

    app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions(){}  and I am able to successfully authenticate google account.

    My problem starts here... 

    My aim is to query Google Calendar data after successful authentication. The code to initialize Calendar service is

       service = new CalendarService(new BaseClientService.Initializer()
                    HttpClientInitializer =
    credential, ??????
                    ApplicationName = ApplicationName,

    My question after successful google login,  how do I retrieve "credential info" in default.aspx.cs page  which I can forward to CalendarService as above.

    Any help


    Wednesday, May 29, 2019 3:39 PM

All replies

  • User1724605321 posted

    Hi jigneshdesai,

    Normally that would be your user's credential , using the resource owner flow to get access token for accessing specific service/api . 

    If you want to login to Google service ,authorize to consent and get access token in on process , you may use code/hybrid flow of OIDC ,but each identity provider has own configuration and supported authentication flows   . You may need to contact Google's support channel to get specific support . 

    Best Regards,

    Nan Yu

    Thursday, May 30, 2019 2:27 AM