title: HTTPS not working with OkHttp3 and Retrofit2
body: <p>Well, I'm having problems to connect with my https URL, all works with postman, but I can´t do it with my Android App, Can someone help me?
  <a href="https://i.stack.imgur.com/Q7YYq.png" rel="nofollow noreferrer">Image of code.</a></p>
  
  <pre><code>public class NetworkUtil{
  public static RetrofitInterface getRetrofit(){
      return new Retrofit.Builder()
              .baseUrl(Constants.BASE_URL)
              .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
              .addConverterFactory(GsonConverterFactory.create())
              .build().create(RetrofitInterface.class);
  }
  public static RetrofitInterface getRetrofit(String email, String password) {
      String credentials = email + ":" + password;
      String basic = "Basic " + Base64.encodeToString(credentials.getBytes(),Base64.NO_WRAP);
  
      OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
  
      httpClient.addInterceptor(chain -&gt; {
          Request original = chain.request();
          Request.Builder builder = original.newBuilder()
                  .addHeader("Authorization", basic)
                  .method(original.method(),original.body());
          return  chain.proceed(builder.build());
      });
      return new Retrofit.Builder()
              .baseUrl(Constants.BASE_URL)
              .client(httpClient.build())
              .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
              .addConverterFactory(GsonConverterFactory.create())
              .build().create(RetrofitInterface.class);
  }
  </code></pre>
  
  <p>I need to authenticate the tokens, how can i add that to the okhttp?</p>
  
  <pre><code>public static RetrofitInterface getRetrofit(String token) {
      OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
  
      httpClient.addInterceptor(chain -&gt; {
          Request original = chain.request();
          Request.Builder builder = original.newBuilder()
                  .addHeader("x-access-token", token)
                  .method(original.method(),original.body());
          return  chain.proceed(builder.build());
      });
      return new Retrofit.Builder()
              .baseUrl(Constants.BASE_URL)
              .client(okHttpClient)
              .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
              .addConverterFactory(GsonConverterFactory.create())
              .build().create(RetrofitInterface.class);
  }
  }
  </code></pre>
  
  <p>Thanks in advance!</p>