New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .net core support for Google.Apis.Auth.Mvc #933

Open
Deren-Liao opened this Issue Mar 15, 2017 · 27 comments

Comments

Projects
None yet
@Deren-Liao

Deren-Liao commented Mar 15, 2017

My understanding, currently Google.Apis.Auth.Mvc does not build for .net core. Please support .net core.

@jskeet

This comment has been minimized.

Show comment
Hide comment
@jskeet

jskeet Mar 16, 2017

Collaborator

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.

Collaborator

jskeet commented Mar 16, 2017

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.

@chrisdunelm

This comment has been minimized.

Show comment
Hide comment
@chrisdunelm

chrisdunelm Apr 3, 2017

Collaborator

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.

Collaborator

chrisdunelm commented Apr 3, 2017

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.

@clement911

This comment has been minimized.

Show comment
Hide comment
@clement911

clement911 Apr 24, 2017

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

clement911 commented Apr 24, 2017

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

@clement911

This comment has been minimized.

Show comment
Hide comment
@clement911

clement911 Apr 24, 2017

Maybe using Google.Apis.Auth instead of Google.Apis.Auth.MVC?

clement911 commented Apr 24, 2017

Maybe using Google.Apis.Auth instead of Google.Apis.Auth.MVC?

@LindaLawton

This comment has been minimized.

Show comment
Hide comment
Collaborator

LindaLawton commented Apr 24, 2017

@clement911

This comment has been minimized.

Show comment
Hide comment
@clement911

clement911 Apr 24, 2017

I believe this uses asp.net 5 but not asp.net core...

clement911 commented Apr 24, 2017

I believe this uses asp.net 5 but not asp.net core...

@LindaLawton

This comment has been minimized.

Show comment
Hide comment
@LindaLawton

LindaLawton Apr 24, 2017

Collaborator

That's all we have then. I don't think anyone has done any Core samples yet.

Collaborator

LindaLawton commented Apr 24, 2017

That's all we have then. I don't think anyone has done any Core samples yet.

@clement911

This comment has been minimized.

Show comment
Hide comment
@clement911

clement911 Apr 24, 2017

I see. I guess I'll have to figure out on my own.

clement911 commented Apr 24, 2017

I see. I guess I'll have to figure out on my own.

@LindaLawton

This comment has been minimized.

Show comment
Hide comment
@LindaLawton

LindaLawton Apr 24, 2017

Collaborator

If you have any issues put up a question on stackoverflow tag it google-api-dotnet-client I will try and help

Collaborator

LindaLawton commented Apr 24, 2017

If you have any issues put up a question on stackoverflow tag it google-api-dotnet-client I will try and help

@chrisdunelm chrisdunelm added this to the v1.27 milestone Apr 24, 2017

@Sigvaard

This comment has been minimized.

Show comment
Hide comment
@Sigvaard

Sigvaard May 19, 2017

I would like to see some NET core MVC samples too.

Sigvaard commented May 19, 2017

I would like to see some NET core MVC samples too.

@murat-mehmet

This comment has been minimized.

Show comment
Hide comment
@murat-mehmet

murat-mehmet Sep 4, 2017

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...

murat-mehmet commented Sep 4, 2017

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...

@jskeet

This comment has been minimized.

Show comment
Hide comment
@jskeet

jskeet Sep 4, 2017

Collaborator

I've answered the Stack Overflow question, but please note that the MVC package is designed for user authentication, not service account authentication.

Collaborator

jskeet commented Sep 4, 2017

I've answered the Stack Overflow question, but please note that the MVC package is designed for user authentication, not service account authentication.

@neooleg

This comment has been minimized.

Show comment
Hide comment
@neooleg

neooleg Oct 16, 2017

@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 commented Oct 16, 2017

@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!

@jskeet

This comment has been minimized.

Show comment
Hide comment
@jskeet

jskeet Oct 16, 2017

Collaborator

@neooleg: From what platform? You say "like in the sample" - what are you trying to do that's different from the sample?

Collaborator

jskeet commented Oct 16, 2017

@neooleg: From what platform? You say "like in the sample" - what are you trying to do that's different from the sample?

@neooleg

This comment has been minimized.

Show comment
Hide comment
@neooleg

neooleg Oct 16, 2017

@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);

neooleg commented Oct 16, 2017

@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);
@jskeet

This comment has been minimized.

Show comment
Hide comment
@jskeet

jskeet Oct 16, 2017

Collaborator

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.

Collaborator

jskeet commented Oct 16, 2017

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.

@neooleg

This comment has been minimized.

Show comment
Hide comment
@neooleg

neooleg Oct 16, 2017

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?

neooleg commented Oct 16, 2017

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?

@jskeet

This comment has been minimized.

Show comment
Hide comment
@jskeet

jskeet Oct 16, 2017

Collaborator

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.)

Collaborator

jskeet commented Oct 16, 2017

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.)

@neooleg

This comment has been minimized.

Show comment
Hide comment
@neooleg

neooleg Oct 16, 2017

@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.

neooleg commented Oct 16, 2017

@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.

@buzallen

This comment has been minimized.

Show comment
Hide comment
@buzallen

buzallen Oct 23, 2017

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:

  • I added a project 'Google.ApisAuth.AspMvcCore'
  • Used the namespace 'Google.Apis.Auth.OAuth2.AspMvcCore'
  • Moved the target to netstandard 1.6 for this project (needed for some references)
  • I couldn't find a replacement in core for the '[AsyncTimeout(10000)]' attribute on the IndexAsync Action
  • When parsing the query string that was returned in the 'AuthorizationCodeActionFilter' the error keys were not in the dictionary (not sure if this is intentional) but it caused an exception so I first checked if the key exists. This was not an issue in the mvc 5 version.

buzallen commented Oct 23, 2017

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:

  • I added a project 'Google.ApisAuth.AspMvcCore'
  • Used the namespace 'Google.Apis.Auth.OAuth2.AspMvcCore'
  • Moved the target to netstandard 1.6 for this project (needed for some references)
  • I couldn't find a replacement in core for the '[AsyncTimeout(10000)]' attribute on the IndexAsync Action
  • When parsing the query string that was returned in the 'AuthorizationCodeActionFilter' the error keys were not in the dictionary (not sure if this is intentional) but it caused an exception so I first checked if the key exists. This was not an issue in the mvc 5 version.
@neooleg

This comment has been minimized.

Show comment
Hide comment
@neooleg

neooleg Nov 4, 2017

@buzallen thanks for update!

Few questions:

  1. Do you plan to update/create a sample?
  2. Why you didn't create a PR yet?

neooleg commented Nov 4, 2017

@buzallen thanks for update!

Few questions:

  1. Do you plan to update/create a sample?
  2. Why you didn't create a PR yet?
@buzallen

This comment has been minimized.

Show comment
Hide comment
@buzallen

buzallen Nov 4, 2017

@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 commented Nov 4, 2017

@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.

@neooleg

This comment has been minimized.

Show comment
Hide comment
@neooleg

neooleg Nov 4, 2017

@buzallen

  1. It make sense to add it for sure.
  2. IMO -- I see no reasons to don't create a PR, so feel free to do it. Otherwise, project members will concern something inside PR, don't worry. Moreover, @jskeet above mentioned about PR, so go ahead.

neooleg commented Nov 4, 2017

@buzallen

  1. It make sense to add it for sure.
  2. IMO -- I see no reasons to don't create a PR, so feel free to do it. Otherwise, project members will concern something inside PR, don't worry. Moreover, @jskeet above mentioned about PR, so go ahead.
@larini

This comment has been minimized.

Show comment
Hide comment
@larini

larini Nov 4, 2017

@buzallen

I´m looking for a working sample too.

larini commented Nov 4, 2017

@buzallen

I´m looking for a working sample too.

@thomasht

This comment has been minimized.

Show comment
Hide comment
@thomasht

thomasht Nov 21, 2017

@buzallen Could you add the PR and sample, please?

thomasht commented Nov 21, 2017

@buzallen Could you add the PR and sample, please?

@neooleg

This comment has been minimized.

Show comment
Hide comment
@neooleg

neooleg Nov 21, 2017

@larini, @thomasht pls check comments in #1109 to be aware.

neooleg commented Nov 21, 2017

@larini, @thomasht pls check comments in #1109 to be aware.

@Trycoder

This comment has been minimized.

Show comment
Hide comment
@Trycoder

Trycoder commented Aug 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment