<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged userauth fail</title>
<link>https://ask.clojure.org/index.php/tag/userauth%20fail</link>
<description>Powered by Question2Answer</description>
<item>
<title>http-kit authorization with api-key</title>
<link>https://ask.clojure.org/index.php/10411/http-kit-authorization-with-api-key</link>
<description>&lt;p&gt;I need to make an API call with  &lt;code&gt;http-kit&lt;/code&gt;  in Clojure where it uses &lt;code&gt;API-Key&lt;/code&gt; as authorization. That is, in Postman, you would usually have the option to add an &lt;code&gt;api-key&lt;/code&gt;, &lt;code&gt;api-value&lt;/code&gt; and the option to add it to &lt;code&gt;header&lt;/code&gt; or &lt;code&gt;query-params&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I know the following would be the way to go in case of basic-auth:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:url &quot;&amp;lt;api-url&amp;gt;&quot;
 :method :post
 :headers {&quot;Content-Type&quot; &quot;application/json&quot;}
 :basic-auth [&amp;lt;username&amp;gt; &amp;lt;password&amp;gt;]
 :body &amp;lt;body&amp;gt;)}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I need to make an API call with http-kit in Clojure where it uses API-Key as authorization. That is, in Postman, you would usually have the option to add an api-key, api-value and the option to add it to header or query-params.&lt;/p&gt;
&lt;p&gt;I know the following would be the way to go in case of basic-auth:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;{:url &quot;&amp;lt;api-url&amp;gt;&quot;
 :method :post
 :headers {&quot;Content-Type&quot; &quot;application/json&quot;}
 :basic-auth [&amp;lt;username&amp;gt; &amp;lt;password&amp;gt;]
 :body &amp;lt;body&amp;gt;)}&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;But a similar variation isn&#039;t working with api-key version. So far, I have tried:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:basic-auth [&amp;lt;api-key&amp;gt; &amp;lt;api-value&amp;gt;]}

{:query-params {&amp;lt;api-key&amp;gt; &amp;lt;api-value&amp;gt;}}

{:query-params {:key &amp;lt;api-key&amp;gt;, :value &amp;lt;api-value&amp;gt;}}

{:headers {&quot;Content-Type&quot; &quot;application/json&quot;, 
                    &amp;lt;api-key&amp;gt; &amp;lt;api-value&amp;gt;}

{:api-key [&amp;lt;api-key&amp;gt; &amp;lt;api-value&amp;gt;]}

{:api-key {&amp;lt;api-key&amp;gt; &amp;lt;api-value&amp;gt;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and other variations, but it doesn&#039;t seem to be working.&lt;/p&gt;
&lt;p&gt;Note: &lt;br&gt;
- The authorization works on postman but I couldn&#039;t test the full api call there because the body is too long and too complex to copy, and the authorization isn&#039;t working from the application.&lt;br&gt;
- I keep getting a 401 error with all these different combinations, and some give typeerrors depending on where in the request they&#039;re placed. &lt;br&gt;
- The documentation isn&#039;t really useful. &lt;a rel=&quot;nofollow&quot; href=&quot;https://documenter.getpostman.com/view/9780542/TVmHDetH#e4296d1e-58f4-4f6d-873f-04fd8a69c872&quot;&gt;Here&lt;/a&gt; is the link. &lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10411/http-kit-authorization-with-api-key</guid>
<pubDate>Wed, 07 Apr 2021 11:07:39 +0000</pubDate>
</item>
<item>
<title>Issue loading cognitect test-runner dependency in deps.edn: USERAUTH fail.</title>
<link>https://ask.clojure.org/index.php/10242/issue-loading-cognitect-test-runner-dependency-deps-userauth</link>
<description>&lt;p&gt;I am trying to use the Cognitect test-runner dependency to run my tests and I am getting a jgit USERAUTH fail when it tries to clone the dependency.  I can use other test runners but I really want to know what is going on here.  Lots of other people have had this issue, but I haven&#039;t found a good explanation of the issue, nor a resolution.  Would appreciate both if anyone can help!&lt;/p&gt;
&lt;p&gt;I&#039;m using:&lt;/p&gt;
&lt;p&gt;Java 8 (tried 11 too)&lt;br&gt;
Mac 10.15.7 (Catalina)&lt;/p&gt;
&lt;p&gt;I have a git ssh key without passcode&lt;/p&gt;
&lt;p&gt;Can someone explain to me what the issue is?  I have an idea that it&#039;s to do with jgit/jsch but I don&#039;t fully understand what the problem is.&lt;/p&gt;
&lt;p&gt;my &lt;code&gt;deps.edn&lt;/code&gt; :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  {:paths [&quot;src&quot; &quot;resources&quot;]
        :deps {org.clojure/clojure {:mvn/version &quot;1.10.2&quot;}}
        :aliases
         { :test {:extra-paths [&quot;test&quot;]
            :extra-deps {com.cognitect/test-runner
                               {:git/url &quot;https://github.com/cognitect-labs/test-runner.git&quot;
                                :sha &quot;209b64504cb3bd3b99ecfec7937b358a879f55c1&quot;}}
            :main-opts [&quot;-m&quot; &quot;cognitect.test-runner&quot;]}}

   
 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;clj -A:test&lt;/code&gt; output:&lt;/p&gt;
&lt;p&gt;   &amp;gt; Cloning: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/cognitect-labs/test-runner.git&quot;&gt;https://github.com/cognitect-labs/test-runner.git&lt;/a&gt; Error&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; building classpath. git@github.com:cognitect-labs/test-runner.git:
&amp;gt; USERAUTH fail org.eclipse.jgit.api.errors.TransportException:
&amp;gt; git@github.com:cognitect-labs/test-runner.git: USERAUTH fail
&amp;gt;         at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:248)
&amp;gt;         at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:306)
&amp;gt;         at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:200)
&amp;gt;         at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:89)
&amp;gt;         at clojure.tools.gitlibs.impl$call_with_auth.invokeStatic(impl.clj:52)
&amp;gt;         at clojure.tools.gitlibs.impl$call_with_auth.invoke(impl.clj:43)
&amp;gt;         at clojure.tools.gitlibs.impl$git_clone_bare.invokeStatic(impl.clj:73)
&amp;gt;         at clojure.tools.gitlibs.impl$git_clone_bare.invoke(impl.clj:70)
&amp;gt;         at clojure.tools.gitlibs.impl$ensure_git_dir.invokeStatic(impl.clj:112)
&amp;gt;         at clojure.tools.gitlibs.impl$ensure_git_dir.invoke(impl.clj:102)
&amp;gt;         at clojure.tools.gitlibs$resolve.invokeStatic(gitlibs.clj:33)
&amp;gt;         at clojure.tools.gitlibs$resolve.invoke(gitlibs.clj:29)
&amp;gt;         at clojure.tools.gitlibs$procure.invokeStatic(gitlibs.clj:47)
&amp;gt;         at clojure.tools.gitlibs$procure.invoke(gitlibs.clj:41)
&amp;gt;         at clojure.tools.deps.alpha.extensions.git$eval1316$fn__1318.invoke(git.clj:42)
&amp;gt;         at clojure.lang.MultiFn.invoke(MultiFn.java:239)
&amp;gt;         at clojure.tools.deps.alpha$expand_deps.invokeStatic(alpha.clj:422)
&amp;gt;         at clojure.tools.deps.alpha$expand_deps.invoke(alpha.clj:390)
&amp;gt;         at clojure.tools.deps.alpha$resolve_deps.invokeStatic(alpha.clj:495)
&amp;gt;         at clojure.tools.deps.alpha$resolve_deps.invoke(alpha.clj:475)
&amp;gt;         at clojure.tools.deps.alpha$calc_basis.invokeStatic(alpha.clj:648)
&amp;gt;         at clojure.tools.deps.alpha$calc_basis.invoke(alpha.clj:622)
&amp;gt;         at clojure.tools.deps.alpha.script.make_classpath2$run_core.invokeStatic(make_classpath2.clj:91)
&amp;gt;         at clojure.tools.deps.alpha.script.make_classpath2$run_core.invoke(make_classpath2.clj:57)
&amp;gt;         at clojure.tools.deps.alpha.script.make_classpath2$run.invokeStatic(make_classpath2.clj:119)
&amp;gt;         at clojure.tools.deps.alpha.script.make_classpath2$run.invoke(make_classpath2.clj:113)
&amp;gt;         at clojure.tools.deps.alpha.script.make_classpath2$_main.invokeStatic(make_classpath2.clj:169)
&amp;gt;         at clojure.tools.deps.alpha.script.make_classpath2$_main.doInvoke(make_classpath2.clj:140)
&amp;gt;         at clojure.lang.RestFn.applyTo(RestFn.java:137)
&amp;gt;         at clojure.lang.Var.applyTo(Var.java:705)
&amp;gt;         at clojure.core$apply.invokeStatic(core.clj:667)
&amp;gt;         at clojure.main$main_opt.invokeStatic(main.clj:514)
&amp;gt;         at clojure.main$main_opt.invoke(main.clj:510)
&amp;gt;         at clojure.main$main.invokeStatic(main.clj:664)
&amp;gt;         at clojure.main$main.doInvoke(main.clj:616)
&amp;gt;         at clojure.lang.RestFn.applyTo(RestFn.java:137)
&amp;gt;         at clojure.lang.Var.applyTo(Var.java:705)
&amp;gt;         at clojure.main.main(main.java:40) Caused by: org.eclipse.jgit.errors.TransportException:
&amp;gt; git@github.com:cognitect-labs/test-runner.git: USERAUTH fail
&amp;gt;         at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:172)
&amp;gt;         at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:140)
&amp;gt;         at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.&amp;lt;init&amp;gt;(TransportGitSsh.java:280)
&amp;gt;         at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:170)
&amp;gt;         at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:137)
&amp;gt;         at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:123)
&amp;gt;         at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1269)
&amp;gt;         at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:237)
&amp;gt;         ... 37 more Caused by: com.jcraft.jsch.JSchException: USERAUTH fail
&amp;gt;         at com.jcraft.jsch.UserAuthPublicKey.start(UserAuthPublicKey.java:119)
&amp;gt;         at com.jcraft.jsch.Session.connect(Session.java:470)
&amp;gt;         at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:126)
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10242/issue-loading-cognitect-test-runner-dependency-deps-userauth</guid>
<pubDate>Wed, 24 Feb 2021 10:15:47 +0000</pubDate>
</item>
</channel>
</rss>