22
I'm able to set the Auth Header on normal HTTPURLConnection requests like this:
URL url = new URL(source);
HttpURLConnection connection = this.client.open(url);
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", "Bearer " + token);
This is standard for HttpURLConnection. In the above code snippet this.client is an instance of Square's OkHTTPClient (here).
I'm wondering if there is an OkHTTP-specific way of setting the Auth Header? I see the OkAuthenticator class but am not clear on how exactly to use it / it looks like it only handles authentication challenges.
Thanks in advance for any pointers.