title: Android OkHttp with Basic Authentication
body: <p>I'm using the OkHttp library for a new project and am impressed with its ease of use.  I now have a need to use Basic Authentication.  Unfortunately, there is a dearth of working sample code.  I'm seeking an example of how to pass username / password credentials to the OkAuthenticator when an HTTP 401 header is encountered.  I viewed this answer:</p>
  
  <p><a href="https://stackoverflow.com/questions/21370620/retrofit-post-request-w-basic-http-authentication-cannot-retry-streamed-http">Retrofit POST request w/ Basic HTTP Authentication: &quot;Cannot retry streamed HTTP body&quot;</a></p>
  
  <p>but it didn't get me too far.  The samples on the <a href="https://github.com/square/okhttp" rel="noreferrer">OkHttp github repo</a> didn't feature an authentication-based sample either.  Does anyone have a gist or other code sample to get me pointed in the right direction?  Thanks for your assistance!</p>