-
Notifications
You must be signed in to change notification settings - Fork 529
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
Using Google.Apis.Auth in .NET 8 #2826
Comments
It's not clear what you mean by "hijacks the existing authentication". Both @amanda-tarafa and I are on vacation at the moment; Amanda knows a lot more about this than I do, and I'm sure she'll look at it when she's back at work next Tuesday. |
Basically I have an application where people authenticate using standard cookie forms authentication. As part of this application there is a function where they need to be able to retrieve Google calendars. Using the Google.Apis.Auth.AspNetCore3 as soon as I do this it logs me out of the primary authentication and logs in as Google. I don't want to do this, I just want for them to log in and get the list of calendars. What would really be ideal was if I could get it running in a service, but I still need the user to authenticate their own credentials before the service can call the Calendar API. This was all possible with the old API. |
I suspect this is more a question of "how do I use multiple forms of authentication in ASP.NET Core" than being specifically about Google auth - my guess is you'd have the same issue with any two auth mechanisms. That may be of some help in terms of research until Amanda and I are back at work. |
Yes, I have an open SO question regarding this https://stackoverflow.com/questions/78919223/combining-googleopenid-and-cookie-authentication-in-asp-net-core-8/78922674 |
As @jskeet and the Stack Overflow user replying to your question have said, this is not a Google Auth specific issue, this is because your application depends on two different sign in mechanisms at the same time, which both depend on cookie schemes and the out of the box capabilities from ASP.NET Core to keep track of a single signed user (HttpContext.User, etc.). Google.Apis.Auth.AspNetCore3 is a helper package to make it easer for ASP.NET Core 3+ applications to support Google OpenID as the sign in mechanism, and that makes user's access tokens readily available to the application. Google.Apis.Auth.AspNetCore3 is not meant to be used alongside other sign in mechanisms that depend on cookie schemes. This is a use case that we are unlikely to consider at the moment for implementation (Note: an exception to that may be #2225 for integrating with .NET Identity, but that's also a particular use case that won't cover using any sing-on mechanism along side something like Google.Apis.Auth.AspNetCore3).
It's not clear here what you mean with "the previous version Google.Apis.Auth" and "the old API". |
Thanks. Are there any examples of authentication with .NET Core 3+ without using the AspNetCore3 package, but using the Google.Apis.Auth package? Basically an example of using GoogleAuthorizationCodeFlow in a .NET Core 3+ app. |
We don't have a sample, but you can use You need to decide how to store user credentials and implement a |
@vanna798756 I'll close this issue as I believe we've answered your questions. Feel free to leave a comment if you believe otherwise and of course, create new issues if you encounter problems when using Google.Apis.Auth. |
We are trying to implement a Google Calendar sync function in our app. We have tried using the Google.Apis.Auth.AspNetCore3 packages but it doesn't seem for purpose as it hijacks the existing authentication in the system.
Is it possible to use the previous version Google.Apis.Auth in .NET 8 without trouble?
For example of our attempts to use Google.Apis.Auth.AspNetCore3 see https://stackoverflow.com/questions/78919223/combining-googleopenid-and-cookie-authentication-in-asp-net-core-8/78922674
The text was updated successfully, but these errors were encountered: