question

Marc avatar image
Marc asked

Connection errors when migrating to Unity 2017.3

Hi,

We are migrating our project from Unity 5.5 to Unity 2017.3, but now we are getting login errors with PlayFab in the Unity Console.

WebException: Error writing request: The authentication or decryption has failed.
System.Net.WebConnectionStream.WriteHeaders ()
System.Net.WebConnectionStream.SetHeaders (System.Byte[] buffer)(wrapper remoting-invoke-with-check) 
System.Net.WebConnectionStream:SetHeaders (byte[])
System.Net.HttpWebRequest.SendRequestHeaders (Boolean propagate_error)
Rethrow as WebException: Error: SendFailure (Error writing request: The authentication or decryption has failed.)
System.Net.HttpWebRequest.EndGetRequestStream (IAsyncResult asyncResult)
System.Net.HttpWebRequest.GetRequestStream ()
PlayFab.Internal.PlayFabWebRequest.Post (PlayFab.Internal.CallRequestContainer reqContainer) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:189)
Rethrow as WebException: SendFailure: WebException making http request to: https://8FF3.playfabapi.com/Client/LoginWithCustomIDUnityEngine.Debug:LogException(Exception)
PlayFab.Internal.PlayFabWebRequest:Post(CallRequestContainer) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:202)
PlayFab.Internal.PlayFabWebRequest:WorkerThreadMainLoop() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:122)
SendFailure: WebException making http request to: https://8FF3.playfabapi.com/Client/LoginWithCustomID
UnityEngine.Debug:LogError(Object)
PlayFabLogin:OnLoginFailure(PlayFabError) (at Assets/PlayFabLogin.cs:22)
PlayFab.Internal.<QueueRequestError>c__AnonStorey0:<>m__0() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:265)
PlayFab.Internal.PlayFabWebRequest:Update() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:346)
PlayFab.Internal.PlayFabHttp:Update() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabHTTP.cs:279)

PlayFab SDK plugin version is 2.34.180102 and our code is the same in both Unity versions.

The PlayfabSharedSettings asset is correctly configured (using the PlayFab Editor Extension) and using Request Type "Http Web Request" as before.

We tested in a dumb project in Unity 2017.3, only with the PlayFab plugin and using the same script as the "Unity Get Started" tutorial. Same errors on login.

I read here about the WWW regressions on the Unity 2017 versions, and you recomend to use HttpWebRequest (with no compression) but the thing is that we are already using HttpWebRequest.

Thank you

unity3dsdks
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

alcomsoftstr avatar image alcomsoftstr commented ·

On Unity 5.6.1p4 error too. And in Safari (iOS), open playfabapi site - worning certificate. For Editor and Android - all ok

0 Likes 0 ·

1 Answer

·
1807605288 avatar image
1807605288 answered

The cause of the issue you're seeing is due to poor testing on our side.

We discovered a security vulnerability with our HttpWebRequest solution, and attempted to patch it.

https://github.com/PlayFab/SDKGenerator/commit/caac06b86d76acd3113bb6eb82ce0df94e910842

Unfortunately, it wasn't properly tested, and it turns out that HttpWebRequest no longer accepts ANY TLS certificate, including our own.

I've spent the last hour on stack overflow looking into this issue, and there does not seem to be any obvious correct solution (I attempted several answers that seemed promising, but they didn't solve the problem).

What can you do:

  1. You can use Unity WWW with compression turned off. (The suggestions in the answer you linked were each independent suggestions, which you can try one at a time).
  2. You can try the new UnityWebRequest option, which was published after the previous round of suggestions were written (also with compression turned off).
  3. You can un-do the security "fix" that I linked above in your local code, and accept all TLS certificates, and continue using HttpWebRequest. (I don't suggest this option, it leaves your players exposed to man-in-the-middle attacks).

I apologize for this mess up. We will endeavor to improve our automated testing in this category, but for now, we don't have a "good" solution for you if you're using HttpWebRequest.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Marc avatar image Marc commented ·

Hi Paul,

Thanks for your answer.

For now, we are delaying our migration to Unity 2017.3. Too many problems when building on the game, weird crashes and little time to solve it... (not related to PlayFab plugin)

When we take it back, we will check your solutions or maybe a new plugin version update will be available.

Thanks again

Marc

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.