question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Integration with .NET Identity

See original GitHub issue

Is 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:open
  • Created a year ago
  • Reactions:2
  • Comments:30 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
amanda-tarafacommented, Jan 12, 2023

After a few more hours attempting to make Google.Apis.Auth.AspNetCore3 with .NET Indentity seamlessly, I haven’t been able to.

  • During H1 2023 we plan to dedicate some deep diving time to better understand how integration between Google.Apis.Auth and .NET Identity should happen, and what effort it would require to implement.
  • Depending on the findings from the point above, implementation may happen on H1 2023, or H2 2023 (most likely), or it may be postponed indefinetely. I’m conscious this is not what you’d prefer to hear.

I’ll come back to this thread as I know more.

3reactions
amanda-tarafacommented, Dec 19, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introduction to Identity on ASP.NET Core
ASP.NET Core Identity: Is an API that supports user interface (UI) login functionality. Manages users, passwords, profile data, roles, ...
Read more >
ASP.NET Identity Integration
ASP.NET Identity Integration. An ASP.NET Identity-based implementation is provided for managing the identity database for users of IdentityServer.
Read more >
Introduction to ASP.NET Identity - ASP.NET 4.x
ASP.NET Identity uses OWIN Authentication for log-in/log-out of users in the web site. This means that instead of using FormsAuthentication to ...
Read more >
Using ASP.NET Core Identity - IdentityServer4 (latest)
AddAspNetIdentity adds the integration layer to allow IdentityServer to access the user data for the ASP.NET Core Identity user database. This is needed...
Read more >
ASP.NET Identity Integration
The first step in creating the sample was to create a new project that used the ASP.NET Identity templates from Visual Studio (“Individual...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found