question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Apache authentication doesn't work

See original GitHub issue

I use Basic Authentication module with ktor client and Apache HTTP. The authentication module fails to insert Authorization header field due to following code:

https://github.com/ktorio/ktor/blob/2205183a5c461878b6da51d03edbca46864f3926/ktor-client/ktor-client-features/ktor-client-auth/jvm/src/io/ktor/client/features/auth/Auth.kt#L48

The status code responded from Apache creates HttpStatusCode("401","") but it compares with the pre-defined status code, which is HttpStatusCode("401","Unthorized"), and it is structurally not equivalent.


Sorry I’m not sure if should also put a question here, but it’s related though…

The way authentication works here from my understand is it tries to call the endpoint once and check for Unauthorized before inserting the Authorization header. This doesn’t make sense to me, if a dev configures HTTP client for authentication, it should mean they expect them to happen, shouldn’t it? Why should the client makes the double calls to do so?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kwaltzercommented, Feb 6, 2020

For the folks arriving here and wondering how to fix it, it was visibly fixed in later versions, but you eventually need to add the “sendWithoutRequest = true” in your basic auth configuration (e.g. : https://api.ktor.io/1.3.1/io.ktor.client.features.auth.providers/-basic-auth-provider/)

1reaction
e5lcommented, Mar 19, 2019

Could you file a separate issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why isn't Apache Basic authentication working? - Server Fault
So auth request didn't appear if IP was correct. I've had to switch Require logic from <RequireAny> to <RequireAll> and it seems that...
Read more >
Apache 2.4 basic auth don't work - Unix & Linux Stack Exchange
I have a problem with basic auth in apache ...
Read more >
basic auth does not work in apache 2.4 - Stack Overflow
It sounds like you might have Apache httpd 2.4.4 installed, which suffers from a known bug in the htpasswd utility.
Read more >
Authentication and Authorization - Apache HTTP Server
Authentication is any process by which you verify that someone is who they claim they are. Authorization is any process by which someone...
Read more >
How To Set Up Password Authentication with Apache on ...
I have just 1 Problem. When I set up the password authentication like in the Tutorial, it doesn't work for https. So what...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found