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");
}
}