title: Retrofit2: how to save cookies from response
body: <p>I need to add some authorization information from cookie in response to next requests.</p>
  
  <p>It works in postman - I make authorization request, then second request, which works fine. But if I delete cookies - second request returns error and I have to do authorization request again.</p>
  
  <p>But in my application this second request always returns the same error. I tried to find needed cookie by using interceptor, but I hadn't found it</p>
  
  <pre><code>val client = OkHttpClient.Builder()
      .addInterceptor(OAuthInterceptor())
  
  private class OAuthInterceptor : Interceptor {
      override fun intercept(chain: Chain): Response {
          val request = chain.request()
          com.app.logic.toLog("${chain.proceed(request).header("set-cookie")} ") // it's not that cookie what I looking for
          val headers = chain.proceed(request).headers()
          headers.names().forEach {
              val s = headers.get(it)
              com.app.logic.toLog("$it -&gt; $s")
          }
          return chain + (Session.authConsumer?.let { consumer -&gt;
              consumer.sign(request).unwrap() as Request
          } ?: request)
      }
  }
  </code></pre>
  
  <p>Does anybody know what else could I try?</p>