title: how to get session cookie from server and set it into the api header?
body: <p>There is cookie header in my api request, every time I have to copy this cookie from postman and paste in my code to make it work. how can I generate cookie in my app and give that value in cookie header?</p>
  <p>this is my login code:</p>
  <pre><code>OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse(&quot;application/json&quot;);
  RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
    .addFormDataPart(&quot;username&quot;,&quot;zee@earthonetechno.com&quot;)
    .addFormDataPart(&quot;password&quot;,&quot;E1234567&quot;)
    .build();
  Request request = new Request.Builder()
    .url(&quot;192.168.1.51/auth/login&quot;)
    .method(&quot;POST&quot;, body)
    .addHeader(&quot;User-Agent&quot;, &quot;Koala Admin&quot;)
    .addHeader(&quot;Content-Type&quot;, &quot;application/json&quot;)
    .addHeader(&quot;Cookie&quot;, &quot;session=3e3710cb-9b41-47ea-ab1b-a1e1801e188b&quot;)
    .build();
  Response response = client.newCall(request).execute();
  </code></pre>
  <p>I want to put the cookie here in <code>addHeader(&quot;Cookie&quot;, &quot;session=3e3710cb-9b41-47ea-ab1b-a1e1801e188b&quot;)</code></p>
  <p>I am developing in android studio</p>