jitpack - Received status code 521/401/403 from server

Viewed 925

My build setting is like below. And I get Received status code 521 from server when I build.

buildscript {
    // ...

    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.2'
        // ...
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url "https://jitpack.io" }
        maven { url 'https://maven.microblink.com' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

ext{
    // ...
}
dependencies {
    // ...

    implementation('com.microblink:blinkinput:4.3.0@aar') {
        transitive = true
    }
}

What's wrong with it?

EDIT:

I am using private repository. So, I set

in gradle.properties. (the key is just an example)

authToken=jp_sldjflkjlzjcxlka1223

And in build.gradle.

...
allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url "https://jitpack.io" }
        maven {
            url "https://jitpack.io"
            credentials { username authToken }
        }
    }
}

This gives me Unauthorized(401) error. So, I tried with this too but it gives Forbidden(403).

...
allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven {
            url "https://jitpack.io"
            credentials { username authToken }
        }
    }
}

The key is correct. And the project built well. It just didn't build well from yesterday.

1 Answers

When you are adding maven jitpack to your project level gradle file you should add your jitpack token too

allprojects {
repositories {
    google()
    jcenter()
    mavenCentral()
    maven { 
      url "https://jitpack.io" 
        credentials { username = project.properties['jitpackToken'] }
    }
    maven { url 'https://maven.microblink.com' }
 }
}

You can find more info here https://jitpack.io/docs/PRIVATE/

Related