Clancey / SimpleAuth

The Simplest way to Authenticate and make Rest API calls in .Net
Apache License 2.0
171 stars 48 forks source link

Instagram Authentication on MacOS - NSURLErrorDomain error -999 #98

Open allan-chin opened 5 years ago

allan-chin commented 5 years ago

Hey @Clancey, I tried the new 1.0.52 on both my UWP and Xamarin.Mac apps. All previous issues seems to be behaving nicely now. However, Instagram authentication is now failing on MacOS only with that same -999 URL error. But this time, it's being thrown in the SimpleAuth.Mac WebAuthenticatorWebView.MonitorAuthenticator() method rather than in FailedProvisionalLoad(), which happened for Dropbox. Here's the exception from the Sample.Mac app included in the SimpleAuth project.

**2019-07-16 09:14:19.910 Sample.Mac[2497:45629] * WARNING: Method convertPointToBase: in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Exception: The operation couldn’t be completed. (NSURLErrorDomain error -999.) System.Exception: The operation couldn’t be completed. (NSURLErrorDomain error -999.) at SimpleAuth.Mac.WebAuthenticatorWebView.MonitorAuthenticator () [0x0002e] in /Users/allan/Projects/GitHub/SimpleAuth/src/SimpleAuth.Mac/WebAuthenticator.cs:32

I downgraded the SimpleAuth Nuget on Mac back to 1.0.51 and the -999 error didn't occur. It seems something bad got introduced in 1.0.52 in this area. Can you please take a look at this?

Thanks

Clancey commented 5 years ago

I wonder if the patch somehow didn't make it into the update. That would be weird. Does it work for you when you use the source?

allan-chin commented 5 years ago

Hey James,

The patch with my fix for the original -999 error got in and is working fine. That fixed a MacOS Dropbox issue. This new -999 error is occurring for Instagram and is occurring in a different method.

And yes, the Sample.Mac app in the 1.0.52 code base exhibits the issue.

Thanks

Allan

From: James Clancey notifications@github.com Sent: Tuesday, July 16, 2019 11:38 AM To: Clancey/SimpleAuth SimpleAuth@noreply.github.com Cc: Chin, Allan allan.chin@hp.com; Author author@noreply.github.com Subject: Re: [Clancey/SimpleAuth] Instagram Authentication on MacOS - NSURLErrorDomain error -999 (#98)

I wonder if the patch somehow didn't make it into the update. That would be weird. Does it work for you when you use the source?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Clancey/SimpleAuth/issues/98?email_source=notifications&email_token=AHJWVBYRJR4V64ANHX2YIXLP7YIQ5A5CNFSM4IECYT3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2BYMFY#issuecomment-511936023, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHJWVBZT2DKCGXHIISL5T3TP7YIQ5ANCNFSM4IECYT3A.

Clancey commented 5 years ago

I can’t duplicate it locally. And that is odd since it is the same error, and you're excluding it with the dropbox patch.

--
James Clancey

On Tuesday, July 16, 2019 at 10:51 AM, allan-chin wrote:

Hey James,

The patch with my fix for the original -999 error got in and is working fine. That fixed a MacOS Dropbox issue. This new -999 error is occurring for Instagram and is occurring in a different method.

And yes, the Sample.Mac app in the 1.0.52 code base exhibits the issue.

Thanks

Allan

From: James Clancey <notifications@github.com (mailto:notifications@github.com)>
Sent: Tuesday, July 16, 2019 11:38 AM
To: Clancey/SimpleAuth <SimpleAuth@noreply.github.com (mailto:SimpleAuth@noreply.github.com)>
Cc: Chin, Allan <allan.chin@hp.com (mailto:allan.chin@hp.com)>; Author <author@noreply.github.com (mailto:author@noreply.github.com)>
Subject: Re: [Clancey/SimpleAuth] Instagram Authentication on MacOS - NSURLErrorDomain error -999 (#98)

I wonder if the patch somehow didn't make it into the update. That would be weird. Does it work for you when you use the source?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/Clancey/SimpleAuth/issues/98?email_source=notifications&email_token=AHJWVBYRJR4V64ANHX2YIXLP7YIQ5A5CNFSM4IECYT3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2BYMFY#issuecomment-511936023, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHJWVBZT2DKCGXHIISL5T3TP7YIQ5ANCNFSM4IECYT3A.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub (https://github.com/Clancey/SimpleAuth/issues/98?email_source=notifications&email_token=AAB6QLXE2U6R6VH6DCWIFQTP7YKCXA5CNFSM4IECYT3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2BZP4I#issuecomment-511940593), or mute the thread (https://github.com/notifications/unsubscribe-auth/AAB6QLRYCMWH5VHY2GBSCXDP7YKCXANCNFSM4IECYT3A).

allan-chin commented 5 years ago

The Dropbox patch is included in 1.0.52 and it authenticates fine by ignoring the -999. I will try to collect some more data points for you when I get back into the office. Meanwhile, you can try my client credentials if you like.

    private const string _clientId_instagram = "7a9f210c7b1d45799115bec03cebd9da"; //TH
    private const string _clientSecret_instagram = "4612b08984ce4e15947d1319886eb83b";
    private const string _redirect_uri_instagram = "http://localhost/hp/OAuth/redirect";

These credentials work with 1.0.51.

Thanks.

From: James Clancey notifications@github.com Sent: Tuesday, July 16, 2019 11:53 AM To: Clancey/SimpleAuth SimpleAuth@noreply.github.com Cc: Chin, Allan allan.chin@hp.com; Author author@noreply.github.com Subject: Re: [Clancey/SimpleAuth] Instagram Authentication on MacOS - NSURLErrorDomain error -999 (#98)

I can’t duplicate it locally. And that is odd since it is the same error, and you're excluding it with the dropbox patch.

-- James Clancey

On Tuesday, July 16, 2019 at 10:51 AM, allan-chin wrote:

Hey James,

The patch with my fix for the original -999 error got in and is working fine. That fixed a MacOS Dropbox issue. This new -999 error is occurring for Instagram and is occurring in a different method.

And yes, the Sample.Mac app in the 1.0.52 code base exhibits the issue.

Thanks

Allan

From: James Clancey <notifications@github.com (mailto:notifications@github.com)mailto:notifications@github.com%20(mailto:notifications@github.com)> Sent: Tuesday, July 16, 2019 11:38 AM To: Clancey/SimpleAuth <SimpleAuth@noreply.github.com (mailto:SimpleAuth@noreply.github.com)mailto:SimpleAuth@noreply.github.com%20(mailto:SimpleAuth@noreply.github.com)> Cc: Chin, Allan <allan.chin@hp.com (mailto:allan.chin@hp.com)mailto:allan.chin@hp.com%20(mailto:allan.chin@hp.com)>; Author <author@noreply.github.com (mailto:author@noreply.github.com)mailto:author@noreply.github.com%20(mailto:author@noreply.github.com)> Subject: Re: [Clancey/SimpleAuth] Instagram Authentication on MacOS - NSURLErrorDomain error -999 (#98)

I wonder if the patch somehow didn't make it into the update. That would be weird. Does it work for you when you use the source?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Clancey/SimpleAuth/issues/98?email_source=notifications&email_token=AHJWVBYRJR4V64ANHX2YIXLP7YIQ5A5CNFSM4IECYT3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2BYMFY#issuecomment-511936023<https://github.com/Clancey/SimpleAuth/issues/98?email_source=notifications&email_token=AHJWVBYRJR4V64ANHX2YIXLP7YIQ5A5CNFSM4IECYT3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2BYMFY#issuecomment-511936023>, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHJWVBZT2DKCGXHIISL5T3TP7YIQ5ANCNFSM4IECYT3A<https://github.com/notifications/unsubscribe-auth/AHJWVBZT2DKCGXHIISL5T3TP7YIQ5ANCNFSM4IECYT3A>.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub (https://github.com/Clancey/SimpleAuth/issues/98?email_source=notifications&email_token=AAB6QLXE2U6R6VH6DCWIFQTP7YKCXA5CNFSM4IECYT3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2BZP4I#issuecomment-511940593https://github.com/Clancey/SimpleAuth/issues/98?email_source=notifications&email_token=AAB6QLXE2U6R6VH6DCWIFQTP7YKCXA5CNFSM4IECYT3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2BZP4I#issuecomment-511940593), or mute the thread (https://github.com/notifications/unsubscribe-auth/AAB6QLRYCMWH5VHY2GBSCXDP7YKCXANCNFSM4IECYT3Ahttps://github.com/notifications/unsubscribe-auth/AAB6QLRYCMWH5VHY2GBSCXDP7YKCXANCNFSM4IECYT3A).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Clancey/SimpleAuth/issues/98?email_source=notifications&email_token=AHJWVB3DAYXK636LW3GAWBLP7YKHHA5CNFSM4IECYT3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2BZTCI#issuecomment-511941001, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHJWVBY6G4M75E2KSPELU4TP7YKHHANCNFSM4IECYT3A.

allan-chin commented 5 years ago

Hi @Clancey - I tested both my TH and the Sample.Mac app again and I want to say it's "intermittent". I quote "intermittent" because I saw it work once on both apps. Once it fails, it seems to fail forever. And I can't seem to make it succeed again. Here's what I see in the output window.

2019-07-16 13:50:14.000 Sample.Mac[6639:170976] *** WARNING: Method convertPointToBase: in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Exception: The operation couldn’t be completed. (NSURLErrorDomain error -999.) System.Exception: The operation couldn’t be completed. (NSURLErrorDomain error -999.) at SimpleAuth.Mac.WebAuthenticatorWebView.MonitorAuthenticator () [0x0002e] in /Users/allan/Projects/GitHub/SimpleAuth/src/SimpleAuth.Mac/WebAuthenticator.cs:32

I've attached a zipped file of the 3 files I changed in your Sample.Mac app which implements an Instagram authentication. I'm running Visual Studio for Mac v8.1.5. You can set a breakpoint on line 45 in the WebAuthenticator file in the SimpleAuth.Mac project.

Thanks

Archive.zip

allan-chin commented 5 years ago

Hi @Clancey - I'm not sure what's going on here now. Today, I can't even get 1.0.51 working anymore for Instagram:(. My TH code has not changed, except for removing and re-adding your Nuget package to toggle between 51 and 52 (I delete the package under packages, and delete the bin and obj folders before re-adding). Could this possibly be a transient Instagram server issue? Are you still not seeing the problem?

I've attached another zip of the files I changed in your Sample.Mac project. I realized my 1st zip was missing a file or 2.

Thanks Archive 2.zip

allan-chin commented 5 years ago

Hi @Clancey - I just submitted another pull request for this Instagram issue on MacOS. Turns out there is another place where we have to ignore the -999 error.

Thanks