Skip to content

//okhttp/okhttp3/Response/challenges

challenges

[jvm]\ fun challenges(): List<Challenge>

Returns the RFC 7235 authorization challenges appropriate for this response’s code. If the response code is 401 unauthorized, this returns the "WWW-Authenticate" challenges. If the response code is 407 proxy unauthorized, this returns the "Proxy-Authenticate" challenges. Otherwise this returns an empty list of challenges.

If a challenge uses the token68 variant instead of auth params, there is exactly one auth param in the challenge at key null. Invalid headers and challenges are ignored. No semantic validation is done, for example that Basic auth must have a realm auth param, this is up to the caller that interprets these challenges.