Jitpack.io: 401 Unauthorized for public repo when building with private repo.

Created on 1 Mar 2019  路  9Comments  路  Source: jitpack/jitpack.io

I receive 401 Unauthorized response for public repo if there's also a private repo inside app dependencies.

Here's stacktrace returned from gradle:

Warning: project ':app': Unable to build Kotlin project configuration
Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':app:debugImplementationDependenciesMetadata'.
Caused by: org.gradle.internal.resolve.ArtifactResolveException: Could not determine artifacts for com.github.phrase:android-sdk:1.0.1
Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://jitpack.io/com/github/phrase/android-sdk/1.0.1/android-sdk-1.0.1.aar'.
Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not HEAD 'https://jitpack.io/com/github/phrase/android-sdk/1.0.1/android-sdk-1.0.1.aar'. Received status code 401 from server: Unauthorized

My app's build.gradle

dependencies {
   ...
    implementation 'com.github.app-craft.android-utils:subs:1.1.7' //private
    implementation 'com.github.phrase:android-sdk:1.0.1' //public
}

And here's root's build.gradle

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://jitpack.io"
            credentials { username <auth_token> }
        }
    }
}

It works ok if I remove dependency to a private repo, but almost always it returns 401 to a public repo if I try to use both.

bug

Most helpful comment

Hi @disparate ,

Should be fixed now.

All 9 comments

Hi,

GitHub is reporting '404 Not Found' for this repository:
https://github.com/phrase/android-sdk

Perhaps it was public previously but at the moment it looks like it is private.

Hello. Thanks for the response.
The repository is private indeed but I can always download that dependency if I don't use my own private dependency on jitpack. (This are installation instructions for the lib https://help.phraseapp.com/phraseapp-over-the-air-ota/android-sdk-installation-instructions).
It also happens with other libs, not only that one.

Also, I guess it's connected with that issue, I tried to open that url that returns 401 for me in browser:
https://jitpack.io/com/github/phrase/android-sdk/1.0.1/android-sdk-1.0.1.aar
It asks me to sign in.
But if I use "incognito" mode on browser it starts download the resource instantly.

@jitpack-io The android-sdk repository is private on Github but the artifacts are public on Jitpack. Is it possible that Jitpack validates the credentials for the public android-sdk repository which causes the failure?

@theSoenke Thanks for the clarification! You're right, the artifacts are public so JitPack shouldn't be asking for credentials.
@disparate Does it work if you only use the 'private' dependency?

@jitpack-io
Yes it is.
The problem only happens when I use both private and public.

Got it. With your help we can now reproduce this issue. Working on a fix...

Hi @disparate ,

Should be fixed now.

@jitpack-io
Seems to be ok now, thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ennru picture ennru  路  4Comments

vananiev picture vananiev  路  5Comments

budowski picture budowski  路  3Comments

jitpack-io picture jitpack-io  路  5Comments

hypest picture hypest  路  5Comments