When making network requests using URLSession, the application encounters a specific issue related to the 403 error code. In this scenario, instead of receiving the expected response from the server, the URLSession throws the error "NSURLErrorClientCertificateRequired" and provides the message "The server requires a client certificate." Consequently, the response and data obtained from the server are nil, despite the fact that all other error codes are handled correctly.
Issue with URLSession Throwing "NSURLErrorClientCertificateRequired" and "The server requires a client certificate" for 403 Error Code
I think that error means exactly what it says: Your request is failing because the server requires mutual TLS authentication. For more context, see TLS for App Developers. In the URLSession
API, you implement mTLS by handling the NSURLAuthenticationMethodClientCertificate
authentication challenge.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Actually, I have checked everything. There is no problem from the server side, it able to get the request and send the response with 403 error code successfully everything is logging properly from the server side, the response is changing into NSURLErrorClientCertificateRequired error, I am sure there is no problem in the request from client side and server side also, And I am able to receive all other responses even 401 response code also, I am facing issue only with 403 response code only.
@eskimo, is there solution for the above issue?
is there solution for the above issue?
I don’t know, and I’m not able to allocate the time to research this properly in the context of DevForums. I recommend that you open a DTS tech support incident and we can pick things up there.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"