Hey folks, new to Ktor, so sorry in advance if this has been asked before.
We don't use basic, digest, or bearer scheme for auth. Just a simple "Authorization:AuthToken" pattern, so I don't believe I can use the Ktor Auth plugin.
I need to attach an "Authorization" header to some of my requests. How can I conditionally apply the header so that it's only attached when needed? I thought to use the HttpSend plugin, but thats basically an interceptor that intercepts every request iiuc.
a
Aleksei Tirman [JB]
04/04/2024, 6:43 AM
You can write your own authentication provider by implementing the
AuthProvider
interface to use the
Auth
plugin or you can manually add the
Authorization
header for each request.
j
Jagtej Sodhi
04/04/2024, 3:40 PM
Got it - happen to have an example for implementing
AuthProvider
approach?
a
Aleksei Tirman [JB]
04/04/2024, 7:25 PM
Please take a look into the implementation of the BasicAuthProvider.