Skip to content
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

Doesn't work in UWP #79

Open
chrisgull opened this issue Dec 31, 2021 · 12 comments
Open

Doesn't work in UWP #79

chrisgull opened this issue Dec 31, 2021 · 12 comments
Labels
help wanted Extra attention is needed

Comments

@chrisgull
Copy link

ConsoleApp sample code works fine as a .NET Core 3.1 console app.
Same code in an UWP app crashes deep in LoginAsync, seems async-related trying to access a disposed Socket object.
I could post a project to reproduce but you already have the code, it's a pretty hard crash and burn.
Let me know if you have questions.
Lars

@f2calv
Copy link
Owner

f2calv commented Dec 31, 2021

@chrisgull The .NET Core 3.1 console itself uses LoginAsync.
I have no experience with UWP so I would appreciate you sharing a test project then I can take a closer look when time allows...

@f2calv f2calv added the question Further information is requested label Dec 31, 2021
@f2calv f2calv self-assigned this Dec 31, 2021
@chrisgull
Copy link
Author

chrisgull commented Dec 31, 2021

Hi Alex, thanks for quick reply.
Attached is a simple UWP project that launches the code from ConsoleApp at startup, as a separate Task.
Look in App.xaml.cs.
You have to fill in your own _userid, _clientid, _clientsecret.
I also tweaked _testfolder to a place I know an UWP app has access to.
For me it crashes consistently in LoginAsync.
I use VS2019. You might have to add some VS install items for UWP.

Other than that, THANK YOU for sharing this package, it's extremely helpful.

Lars
LoginAsyncIssue2.zip

@chrisgull
Copy link
Author

More info:
This page says the UWP project need to declare a capability "privateNetworkClientService".

https://docs.microsoft.com/en-us/windows/uwp/networking/sockets

This is missing in the project above. Adding such capability does however not resolve the issue.
I'm updating the above attached project to reflect this, the updated project is named LoginAsyncIssue2.zip.

@chrisgull
Copy link
Author

chrisgull commented Dec 31, 2021

OK, some research yielded this: you are using google.apis.auth, which does not support UWP.
See https://github.com/googleapis/google-api-dotnet-client
Might be tricky to convince Google to fix that. I'm going to try, but don't expect results.

@chrisgull
Copy link
Author

I'm going to try Maui again, see if I can leave UWP behind soon. With some luck your package should work as is.

@f2calv
Copy link
Owner

f2calv commented Jan 5, 2022

Ok and good luck :)

@f2calv f2calv closed this as completed Jan 5, 2022
@chrisgull
Copy link
Author

OK. Tried Maui.
Maui sits on top of WinUI, which makes it a proper Win32 process. So the Google auth library works fine (but Maui is far from ready).

Not sure why you closed this issue - it's still an issue? Should I open a new issue?

@f2calv f2calv reopened this Jan 5, 2022
@f2calv
Copy link
Owner

f2calv commented Jan 5, 2022

I have re-opened it, but at the moment I've very little time to further investigate...

@dcuccia
Copy link

dcuccia commented Jan 5, 2022

@chrisgull interested in what your use case is for UWP. I've tried it successfully it in both WPF and MAUI Hybrid (Blazor), FWIW.

@chrisgull
Copy link
Author

I have re-opened it, but at the moment I've very little time to further investigate...

Keeping it open communicates that UWP is not at this time working (and my comments above tell others that it's a Google problem).

@chrisgull
Copy link
Author

@chrisgull interested in what your use case is for UWP. I've tried it successfully it in both WPF and MAUI Hybrid (Blazor), FWIW.

Xamarin, which only supports UWP on windows.
Net 6.0 Maui will change that, sitting on top of WinUI 3, which means none of the UWP sandbox limitations.

@f2calv f2calv removed their assignment Jan 8, 2022
@f2calv f2calv added help wanted Extra attention is needed and removed question Further information is requested labels Jan 8, 2022
@HolzetheKid
Copy link

Hallo ,
if any one is interested in an Example of UWP authentication check the sampel app from google.
https://github.com/googlesamples/oauth-apps-for-windows/tree/master/OAuthUniversalApp

and if you want the oaut working in Xamarin check this doc: https://codingforfun.de/xamarin-google-authentication-with-oauth/
github

i should be easily translated to maui!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants