ASWebAuthenticationSession and additionalHeaderFields

I'm trying to set a Cookie on ASWebAuthenticationSession on iOS 17.4+ using the new available method additionalHeaderFields. I can use this method to set any header field but "Cookie". As soon as I try to set this header, I receive the following error:

Cannot start ASWebAuthenticationSession: Error Domain=com.apple.AuthenticationServices.WebAuthenticationSession Code=1 "One or more provided headers are invalid." UserInfo={NSLocalizedFailureReason=One or more provided headers are invalid.}
 

The same content, but with different name ("Foo") is inserted as a header in the request.

So, are there any limitation about setting cookies on ASWebAuthenticationSession? I've found any information abut this

Answered by Systems Engineer in 797134022

The additionalHeaderFields value follows the Fetch standard's forbidden request header algorithm. Cookie is one of the forbidden fields.

The additionalHeaderFields value follows the Fetch standard's forbidden request header algorithm. Cookie is one of the forbidden fields.

ASWebAuthenticationSession and additionalHeaderFields
 
 
Q