Feature Request: Send HTTP requests from Authenticator
See original GitHub issueHi,
I’d like to have a way to send some HTTP requests from the Authenticator
because some authentication mechanisms need it in its workflow (for example: OAuth).
As workaround, for the moment,
- I can create a new instance of
OkHttpClient
but I’m not sure it is a good practice, or - I can add a
setHttpClient
method inAuthenticator
:
MyAuthenticator authenticator = new MyAuthenticator();
OkHttpClient client = new OkHttpClient.Builder()
.authenticator(authenticator)
.build();
authenticator.setHttpClient(client);
But
OkHttpClient client = new OkHttpClient.Builder()
.authenticator(new MyAuthenticator(client))
.build();
is not possible.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
[Feature Request] Define authentication setting on ... - GitHub
I connect to one API service with many requests. I now have to set the authentication settings on each request. But, because it's...
Read more >Use additional context in Microsoft Authenticator notifications
Learn how to use additional context in MFA notifications.
Read more >Authentication — Requests 2.28.1 documentation
Many web services that require authentication accept HTTP Basic Auth. This is the simplest kind, and Requests supports it straight out of the...
Read more >Cross-Origin Resource Sharing (CORS) - MDN Web Docs
Additionally, for HTTP request methods that can cause ... (such as Cookies and HTTP Authentication) should be sent with requests.
Read more >Sending API requests using cURL - Oracle Help Center
Authentication ; Sending a GET request; Sending a DELETE request; Sending a POST request; Sending a PUT request. Note: The code samples in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
One workaround is to use OkHttpClient.newBuilder():
Yep. That’s a big backwards-incompatible change. We’ll add it to the list of things to consider for okhttp4 in 2021.