My understanding, currently Google.Apis.Auth.Mvc does not build for .net core. Please support .net core.
Assigned to Chris for initial comment, as I can't remember what the status is here.
Although if Google.Apis.Auth.Mvc targets "full" ASP.NET, I'm not sure it makes much sense to support it on .NET Core - we'd want something which targets ASP.NET Core instead. If it's neutral though (it doesn't look like it has a dependency on ASP.NET...) it would make more sense.
I'll have a look soonish to see if .NET Core support for Google.Apis.Auth.Mvc makes sense.
And even if it doesn't, it could do with being updated to use a targeted nuspec.
Hi there,
I'm also looking at using oauth2 from my asp.net core to access the drive api and sheets api.
Is it possible? Is there a sample?
Update: If it makes any difference, I'm using asp.net core on top the full .net framework (not .net core) so I'm happy to use any lower level apis that may be available in the existing nuget package targeted at the full .net framework. I can probably just reimplement the controller myself and inherit from the asp.net core controller class instead of the asp.net one, but I'm just not sure how to go about this...
Thanks
Maybe using Google.Apis.Auth instead of Google.Apis.Auth.MVC?
only thing i am aware of https://github.com/google/google-api-dotnet-client-samples/tree/master/Calendar.ASP.NET.MVC5
I believe this uses asp.net 5 but not asp.net core...
That's all we have then. I don't think anyone has done any Core samples yet.
I see. I guess I'll have to figure out on my own.
If you have any issues put up a question on stackoverflow tag it google-api-dotnet-client I will try and help
I would like to see some NET core MVC samples too.
Please help me on Stack overflow about this issue. I'm totally stuck and my app is vulnerable at the moment because I cannot verify in-app purchases on the server side...
I've answered the Stack Overflow question, but please note that the MVC package is designed for user authentication, not service account authentication.
@jskeet, do you have any a link for Stack Overflow or other reference for _User_ authentication _accessing Google API_, e.g. Calendar API like in the sample. I still can't find anything useful for awhile.
Thanks in advance!
@neooleg: From what platform? You say "like in the sample" - what are you trying to do that's different from the sample?
@jskeet: Platfrom is .NET Core 2.0
I try to do exactly the same -- _call Calendar API using .NET Core and Google OAuth 2.0_.
However, the following code from the sample doesn't work on Core because OWIN I guess:
var identity = await HttpContext.GetOwinContext().Authentication.GetExternalIdentityAsync(DefaultAuthenticationTypes.ApplicationCookie);
var userId = user.FindFirstValue(MyClaimTypes.GoogleUserId);
But the sample isn't using .NET Core - it's using ASP.NET MVC.
Basically, what you're requesting is that this issue is fixed - ASP.NET Core support in the same style as Google.Apis.Auth.Mvc.
But the sample isn't using .NET Core - it's using ASP.NET MVC.
Sure, I know. However, what I've missed it seems -- is that not only the sample is outdated (i.e. isn't .NET Core), but the _library which required to allow API calls working_ is also not updated for .NET Core.
In other words, __there is no ability to call Calendar API from .NET Core for now__.
Am I correct?
The sample isn't "outdated" in that there are still plenty of users who will be using ASP.NET rather than ASP.NET Core.
And you certainly can call the Calendar API from ASP.NET Core now - but you'd need to reimplement the functionality provided by the Google.Apis.Auth.Mvc library. All the code is available, and there's not a huge amount of it. If you wanted to create a pull request to fix this issue yourself, that would be most welcome - it's just been lower down our priority list than other work. (There may be other OAuth2 libraries that would do the bulk of the work, leaving you just to create the final token, too.)
@jskeet: Thanks for complete answer! I'll investigate it detailed.
P.S. Apologize me to use inappropriate word for sample characteristic. I just meant it doesn't support .NET Core.
I forked this and have a version that works for Mvc Core apps. Wanted to pass what I did by and if the way I set it up is OK then I'll submit a PR.
Notes:
@buzallen thanks for update!
Few questions:
@neooleg
1 - I certainly can create a sample, I have a basic proof of concept app I created when I updated the library.
2 - I'm new to contributing and since what I did involved added a new project and namespace I thought I might run it by the project owners to verify it matched the way they do things before I submitted a PR.
If anyone has thoughts on this or if it makes sense for me to generate a PR with what I have let me know.
@buzallen
@buzallen
I麓m looking for a working sample too.
@buzallen Could you add the PR and sample, please?
@larini, @thomasht pls check comments in https://github.com/google/google-api-dotnet-client/pull/1109 to be aware.
Hi,
Can i Use the flow as mentioned in https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth#web-applications-aspnet-mvc for Web API 2 also?
Support for ASP.NET Core 2.0+ is now available in the Google.Apis.Auth.AspNetCore beta package on nuget: https://www.nuget.org/packages/Google.Apis.Auth.AspNetCore/1.36.1-beta01
@chrisdunelm is there a sample code for using this anywhere? https://www.nuget.org/packages/Google.Apis.Auth.AspNetCore/1.36.1-beta01
the only example we have for asp .net core is the tests themselves. I tried to put together a sample a few weeks ago and was unable to get it to work. It would authenticate but when trying to access an API I was getting unauthorized I suspect it was cookie related I haven't had time to look into it further.
Most helpful comment
I would like to see some NET core MVC samples too.