Microsoft Visual Studio Professional 2017
Version 15.9.12
VisualStudio.15.Release/15.9.12+28307.665
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.
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 .
Member
1 Points
31 Posts
How to access Google Calendar API via ready Owin Authentication template in ASp.NET WebForms
May 29, 2019 03:39 PM|jigneshdesai|LINK
I am using following version.
Microsoft Visual Studio Professional 2017
Version 15.9.12
VisualStudio.15.Release/15.9.12+28307.665
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
Regards
All-Star
18815 Points
3831 Posts
Re: How to access Google Calendar API via ready Owin Authentication template in ASp.NET WebForms
May 30, 2019 02:27 AM|Nan Yu|LINK
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