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

GoogleWebAuthorizationBroker.AuthorizeAsync crash on HoloLens #763

Closed
mateusz-piasecki opened this issue Jun 23, 2016 · 20 comments
Closed
Assignees

Comments

@mateusz-piasecki
Copy link

mateusz-piasecki commented Jun 23, 2016

Hello,
I just begin testing my Windows 10 UWP app on HoloLens (emulator). It crashes on login GoogleWebAuthorizationBroker.AuthorizeAsync
When I type (proper) auth data it throws
Exception thrown: 'System.AggregateException' in mscorlib.ni.dll
and in InnerException I get this:
http://i.imgur.com/vObH7s4.jpg
Same code works fine on Windows 10 PC and Mobile.
PS. To reproduce it you'll need Windows 10 machine, VS 2015 Update 2 and HoloLens SDK installed.
PS2. Currently I use Google.Apis.Drive.v3 v1.12.0.455 and I didn't test newer version, because of release config error which I mentioned in #752 .

@jskeet
Copy link
Collaborator

jskeet commented Jun 23, 2016

Thanks for the report. I'll try to take a look as soon as I can. Could you provide a short but complete example demonstrating the problem, so we can see how you're trying to authenticate?

@jskeet jskeet self-assigned this Jun 23, 2016
@mateusz-piasecki
Copy link
Author

@jskeet I can, but you'll have to wait till tomorrow.

@jskeet
Copy link
Collaborator

jskeet commented Jun 23, 2016

That's fine - I'm very unlikely to be able to get to it imminently anyway, I'm afraid.

@mateusz-piasecki
Copy link
Author

mateusz-piasecki commented Jun 27, 2016

OK, I've got example which recreates the problem. Just remember to add your client_secret
GoogleDownload.zip

@jskeet
Copy link
Collaborator

jskeet commented Jun 27, 2016

Thanks, will take a look when I can.

@jskeet
Copy link
Collaborator

jskeet commented Jun 27, 2016

Hmm. Have installed the emulator, downloaded the sample, downloaded a client_secret.json file, put it in the Assets directory and changed it to a build action of Content... and everything works. When I click on "Click me", I'm prompted for my username and password, then 2 factor auth, then permission - everything works fine.

At what point does it break for you?

@mateusz-piasecki
Copy link
Author

mateusz-piasecki commented Jun 27, 2016

It throws exception when you give permission to your account

@jskeet
Copy link
Collaborator

jskeet commented Jun 27, 2016

Right, so it got as far as the screen saying "Are you happy for this application to access Drive"? Does it happen every time, or just occasionally? It's tricky as I'm failing to reproduce it at the moment. I assume you have a working network connection and everything? Just grasping at straws at the moment :(

@jskeet
Copy link
Collaborator

jskeet commented Jun 27, 2016

One extra quick check - could you use ildasm to have a look at which versions of Google.Apis.Auth and Google.Apis.Auth.PlatformServices are being pulled in? On my box it's 1.11.1.0, which I suspect is what you've got as well, but I thought I'd check...

@mateusz-piasecki
Copy link
Author

Yes, it's v1.11.1
Yes, I've got internet connection 'and everything' :D To be sure that we understand each other correctly I've attach video where I recreate issue - it happened 7/7 tries.
Nagywanie_2016_06_27_15_39_25_621.zip

@jskeet
Copy link
Collaborator

jskeet commented Jun 27, 2016

Thanks for the video. Will scratch my head and see what I can do to provoke it here :(

@jskeet
Copy link
Collaborator

jskeet commented Jun 28, 2016

Gah - stupidly, I hadn't actually been launching it in the HoloLens emulator... so I'd just been seeing it working in the UWP version. Now launched HoloLens emulator, and am failing to use it... but hopefully I'll be able to reproduce it now.

@mateusz-piasecki
Copy link
Author

If it's the error about UDP port - I've been there - there is a lot instructions on the internet about how to fix that. But if you have second machine to test it, maybe it will be luckier. I had this problem on one computer, couldn't fix it, but on my second machine emulator worked out-of-the-box.

@jskeet
Copy link
Collaborator

jskeet commented Jun 28, 2016

No errors about the UDP port - just failing to click on the button at all, despite toggling the "use keyboard and mouse". Will keep trying.

@jskeet
Copy link
Collaborator

jskeet commented Jun 29, 2016

Okay, good news - I've managed to reproduce your exact error. Next I'll see if I can do that with a debug version of the auth library.

@jskeet
Copy link
Collaborator

jskeet commented Jun 29, 2016

When you said in the first comment:

Currently I use Google.Apis.Drive.v3 v1.12.0.455 and I didn't test newer version, because of release config error which I mentioned in other issue

Which other issue are you talking about? I can only see one issue in Github from you at the moment.

@mateusz-piasecki
Copy link
Author

This one:
#752

@jskeet
Copy link
Collaborator

jskeet commented Jun 29, 2016

@Piachu91: Gotcha, thanks. Was confused by Github's time filter. Will edit your first comment to refer to it, for simplicity.

@jskeet
Copy link
Collaborator

jskeet commented Jun 29, 2016

Okay, it looks like this is Hololens being broken, as far as I can tell. You can reproduce the problem without any Google client code:

string clientId = // Insert your client ID here; it's in the JSON file
string approvalUrl = "https://accounts.google.com/o/oauth2/approval";
string escapedScope = "https:%2F%2Fwww.googleapis.com%2Fauth%2Fdrive";
string requestUrl = $"https://accounts.google.com/o/oauth2/auth?access_type=offline&response_type=code&client_id={clientId}&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope={escapedScope}";

WebAuthenticationResult result = await WebAuthenticationBroker.AuthenticateAsync
                    (WebAuthenticationOptions.UseTitle, new Uri(requestUrl), new Uri(approvalUrl));

Doing this in the Hololens emulator, you end up with a result with:

  • ResponseData = "Request for Permission"
  • ResponseErrorDetail = 0
  • ResponseStatus = Success

When running as a desktop app, you end up with a result with:

  • ResponseData = "Success code=[code stuff here]"
  • ResponseErrorDetail = 0
  • ResponseStatus = Success

I suspect it would be worth reporting this to MS. Are you happy to do that?

@mateusz-piasecki
Copy link
Author

mateusz-piasecki commented Jun 29, 2016

Yes, I'll be happy to
seeing in my head that Microsoft sends HoloLens device to Poland as a thank you 💃 😄
Thanks for taking care of the issue, now I'm closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants