Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Basic authentication #71

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

tomob commented Oct 10, 2012

0.4.0 breaks authentication.

Added a sweet little fix that makes it working again.

Contributor

cemerick commented Oct 10, 2012

Authentication works properly in 0.4.0; just put the credentials on a URL record (or, alternatively, inline in a URL string). From the README:

(def db (assoc (cemerick.url/url "https://XXX.cloudant.com/")
                 :username "username"
                 :password "password"
                 :path "databasename"))

Does this help?

@cemerick cemerick closed this Oct 10, 2012

tomob commented Oct 10, 2012

Strange.

It does work on Windows, Lein 1.7.1. It doesn't work on Mac, Lein 2.0.0. It doesn't work for both URL string and URL record.

I just noticed Clojure on Win is at 1.2.1, while on Mac it's 1.3.0, but my project.clj asks for 1.4.0. Windows box is not my primary development machine, I was just around it and it was convenient to run a quick test...

I guess I need to investigate it some more.

Contributor

cemerick commented Oct 10, 2012

The handling of authentication fields by url should be entirely unaffected by platform, lein version, or Clojure version. Of course, YMMV, but I'd be really surprised if those factors were in play here.

tomob commented Oct 10, 2012

Exactly. I'm sitting here puzzled.

What I'm planning to do when I get a moment is to check versions of all dependencies that do take part in this (cemerick.url, clj-http etc). I might also just clean Maven caches and re-download all packages on both machines.

Leiningen changed the way the classpath is build between 1.x and 2.0. That might have some impact (and would hint a bug in lein, if it turns out to be the case).

tomob commented Oct 10, 2012

Also, clutch 0.3.1 worked on the Mac.

tomob commented Oct 11, 2012

Found it. It was Leiningen after all.

In 2.0.0, lein repl loads clj-http 0.3.5 on start. So when clutch asks for it, hoping to get 0.4.1, the older version is referenced.

Running the very same code with lein run shows that clutch works very well indeed.

Contributor

cemerick commented Oct 11, 2012

Are you working on a Leiningen plugin? That's the only circumstance where its dependencies would ever potentially come into play. (Clutch is tested and built with lein 2, which doesn't interfere there.)

Feel free to post your project.clj, if you think that will be clarifying.

tomob commented Oct 11, 2012

No, I don't work on a Leiningen plugin. The problem with conflicting clj-http jars only occurs in lein repl. lein run works fine. I'm using 2.0.0-preview10 version of lein (that's what Homebrew let's me easily install). I haven't tried with HEAD version of lein. I plan to, but can't at the moment (day job, sigh).

The project.clj contains nothing interesting. I've just started the project.

(defproject blahblah-gui "0.1.0-SNAPSHOT"
  :description "Blah Blah (GUI)"
  :url "http://www.blahblah.com"
  :dependencies [[org.clojure/clojure "1.4.0"]
                 [noir "1.2.2"]
                 [com.ashafa/clutch "0.4.0-SNAPSHOT"]]
  :main blahblah.gui.server)
Contributor

cemerick commented Oct 11, 2012

Oh....this is because lein repl adds a dependency on [org.thnetos/cd-client "0.3.4"], which ropes in the older version of clj-http. Damn.

The workaround at the moment would be to put [clj-http "0.5.5"] in your project.clj, which will override that. Meanwhile, here's the issue you should track for now:

technomancy/leiningen#815

tomob commented Oct 11, 2012

"cemerick opened this issue 8 months ago"

That gives hope :)

Thanks for the workaround.

Contributor

cemerick commented Oct 11, 2012

Sorry, I originally linked to a related, but far more difficult problem. technomancy/leiningen#815 is your issue, and far more tractable AFAICT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment