xamarin / Xamarin.Auth

Xamarin.Auth
Apache License 2.0
541 stars 351 forks source link

After call OnPageLoading on iOS and Android Receive an error event utf-8 is not a supported encoding name. #311

Closed Elinareso closed 6 years ago

Elinareso commented 6 years ago

Xamarin.Auth Issue

Version

Steps to reproduce

  1. After a success authentication with Facebook
  2. The OpenUrl or CustomUrlSchemeInterceptorActivity is being called
  3. The AuthenticationState.Authenticator.OnPageLoading(uri) is called
  4. The event called Authenticator_Error(object sender, AuthenticatorErrorEventArgs e) is called with the following Exception.

'"utf-8"' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. Parameter name: name@

Platform:

Expected behaviour

After a success authentication process with Facebook, call the Complete event with the flag IsAuthenticated true and close the browser to display the Mobile App.

Actual behaviour

The error event is being call after a success authentication with Facebook including one Exception that says:

Exception Message:

'"utf-8"' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. Parameter name: name@

The StackTrace:

at System.Globalization.EncodingTable.internalGetCodePageFromName (System.String name) [0x00082] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/mcs/class/corlib/ReferenceSources/EncodingTable.cs:799 at System.Globalization.EncodingTable.GetCodePageFromName (System.String name) [0x00024] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/mcs/class/corlib/ReferenceSources/EncodingTable.cs:862 at System.Text.Encoding.GetEncoding (System.String name) [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/text/encoding.cs:696 at System.Net.Http.HttpContent+d20.MoveNext () [0x000d5] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/mcs/class/System.Net.Http/System.Net.Http/HttpContent.cs:182 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535 at Xamarin.Auth.OAuth2Authenticator+d45.MoveNext () [0x00108] in <5426a6dbbfb9439a9005b7bf164bb3d1>:0

oautherror

Facebook Configuration

"ClientId": "98*66449" "ClientSecret": "8a459**18c16bab732****" "Scope": "email" "AuthorizeUrl": "https://www.facebook.com/dialog/oauth/", "RedirectUrl": "fb98*66449****://authorize", "AccessTokenUrl": "https://m.facebook.com/dialog/oauth/token" "IsUsingNativeUI": true

Response Uri fb98*66449**://authorize/?code=AQAqY6X9JIb9S0G_*****DPVW9Hm0k7W1jXdudcqg0G0GFLN54nq6leS8rak8Z-n_n-23LB04t8gYg0GFqNktvrXefSyEGgrpOaeGDL**_lOY-vYY0Yyts_mZJPQ**gAwQ0mptS0kz1djF-v2lMWby3vq249BNHRUtEBxD*****qEuu9bFJKgyGpXZpZTkebxJ9iuAeuTOAqt--9Wgl-QaI1dPqb3B**zT5ZyqiVcMFa2DaK9rc&state=obsi****tlm#=_

NOTE

I changed several character to use *(asterisk) instead to hide the sensitive data.

Works with

The same version works perfectly with Google Oauth configuration.

I hope this can be enough information to fix this issue or give a guidance to solve it.

newky2k commented 6 years ago

@Elinareso can you please provide a small sample that replicates the issue so we can investigate

newky2k commented 6 years ago

no response for over two weeks, closing