Integration with .NET Identity
See original GitHub issueIs your feature request related to a problem? Please describe. There seem to be no built-in way to use the authentication (access_token) you get from an external login (Google) with .NET Identity with Google API.
The best I can find is essentially “don’t use Identity, just use OpenIdConnect”. Unfortunately, the system I am working on relies on other features that Identity offers, which forces me to having to stick with Identity. Moreover, I have realised that the GoogleOpenIdConnect authentication returns an authorized user as long as you are logged in to Google on the browser, meaning that I cannot have an “Identity login” at the same time. I have a set of existing Identity users, all with an external Google login. These users are then assigned roles by the application. Using GoogleOpenIdConnect would prevent me to keep using those roles as far as I understand.
Describe the solution you’d like
Be able to use IGoogleAuthProvider with Microsoft Identity and Google external login (.AddGoogle()
), like when you use .AddGoogleOpenIdConnect
.
Describe alternatives you’ve considered
-
Manually intercept the access_token received during the .NET Identity external login and use that to initialize Google API services. This works, but persisting the token is a problem: implementing a solution that handles security, multi users, caching, refreshing etc would require too many resources
-
Use
.AddGoogleOpenIdConnect
in conjunction with.AddGoogle
. This doesn’t work as the two login seem to conflict with each other - I am logged out of one when I call login with the other.
Additional Context I am working on a .NET6 Website. This website will have multiple users and will allow them to upload videos to either their Drive account or their Youtube channel. I can get this to work easily when running locally as I can use the ‘Installed Applications’ way of authenticating. I cannot get this to work when deployed on a server.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:30 (13 by maintainers)
Top GitHub Comments
After a few more hours attempting to make Google.Apis.Auth.AspNetCore3 with .NET Indentity seamlessly, I haven’t been able to.
I’ll come back to this thread as I know more.
@fracampit Thank you for your patietence. I don’t think I can get back to this unitl January, but I’m still hoping I can get it to workg without huge changes. I’ll come back here when I know more, and as long as the issue is open, it is in our radar!