- Home /
Unity iOS WWW POST failing ssl handshake
I'm attempting to retrieve a token from a REST endpoint in an iOS app, but I'm getting an error in my SSL handshake. The error, as seen in Xcode's output logger is below
2017-10-23 11:22:42.247770-0400 app[791:303489] [BoringSSL] Function boringssl_session_handshake_error_print: line 3102 boringssl ctx 0x155d7ad60: 5759831312:error:10000417:SSL routines:OPENSSL_internal:SSLV3_ALERT_ILLEGAL_PARAMETER:/BuildRoot/Library/Caches/com.apple.xbs/Sources/boringssl/boringssl-109.2.2/ssl/tls_record.c:547:SSL alert number 47
2017-10-23 11:22:42.247843-0400 app[791:303489] [BoringSSL] Function boringssl_context_get_os_status: line 4027 SSL_AD_ILLEGAL_PARAMETER
2017-10-23 11:22:42.249183-0400 app[791:303489] TIC TCP Conn Failed [1:0x1c417be40]: 3:-9830 Err(-9830)
2017-10-23 11:22:42.249383-0400 app[791:303489] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9830)
2017-10-23 11:22:42.249436-0400 app[791:303489] Task <7D65D422-D111-479C-AF10-1AB8394DD3DD>.<0> HTTP load failed (error code: -1200 [3:-9830])
2017-10-23 11:22:42.249764-0400 app[791:303489] NSURLConnection finished with error - code -1200
some error:Unable to complete SSL connection
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
<getBearerToken>c__Iterator1:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
The C# code associated with this call is below.
IEnumerator getBearer() {
WWWForm form = new WWWForm ();
form.AddField ("grant_type", "client_credentials");
form.AddField ("client_id", "[id]");
form.AddField ("client_secret", "[secret]");
Hashtable head2= new Hashtable();
head2.Add ("Content-Type", "application/x-www-form-urlencoded");
WWW bearerwww = new WWW ("[endpoint]", form.data, head2);
yield return StartCoroutine (getBearerToken (bearerwww));
Debug.Log ("?");
}
IEnumerator getBearerToken(WWW bearerwww) {
yield return bearerwww;
if (!string.IsNullOrEmpty(bearerwww.error)) {
Debug.Log ("some error:" + bearerwww.error);
} else {
var body = JSON.Parse(bearerwww.text);
Debug.Log (body);
bearer_token = body ["access_token"];
Debug.Log ("should have bearer");
}
}
@juan_arias Did you find an answer to this issue? I am having the same error in Unity 2018.3.8 on an iOS build.,Is there an answer for this issue? I am seeing the exact same thing. Unity 2018.3.8
@juan_arias this could be an issue with your end-point. I am not sure what your endpoint is, but what happens when you try to access it through Postman for example?
Works fine through postman and even on Android build. This is a microsoft login end point.
A lot of Windows-based endpoints use NTL$$anonymous$$ or (even worse) NTL$$anonymous$$v2 authentication. It may be the case that the iOS web request libraries simply don't support that type of authentication.
At a $$anonymous$$imum, check your player settings and make sure you're not using .NET 2.0 Subset - I've found the subset version doesn't include all authentication methods, while the full version seems to.
If you've got any control of the server, check group policy. Some servers are configured to insist on NTL$$anonymous$$v2 authentication, which isn't all that compatible with non-$$anonymous$$icrosoft solutions. If you've got the chance to allow earlier versions of NTL$$anonymous$$, it may help.
Answer by galalhassan · Jul 02, 2019 at 12:42 AM
@Juan_arias & @kambrusterxstud Try using UnityWebRequest instead of WWW. This solved an SSL issue for me before.
Thanks for the help. We are using UnityWebRequest.
I've found this thread and have been working through it. Will post with results.
Cool, good luck and let us know how it goes.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
UnityWebRequest ContentType not Overriding 4 Answers
WWW with https resulting in SSL: couldn't create a context 0 Answers
WebClient on Android 0 Answers