pdf-builder icon indicating copy to clipboard operation
pdf-builder copied to clipboard

Unauthorized error

Open chavu opened this issue 3 years ago • 1 comments

I'm getting the rror below. WHat credentials shoudl I use?

-------------ERROR MSG--------------------------- Could not GET 'https://maven.pkg.github.com/timrs2998/pdf-builder/com/github/timrs2998/pdf-builder/1.9.0/pdf-builder-1.9.0.pom'. Received status code 401 from server: Unauthorized Disable Gradle 'offline mode' and sync project

chavu avatar Jan 16 '22 08:01 chavu

Since JCenter is deprecated I switched to GitHub packages for lack of a better solution. Unfortunately it requires authentication to download packages. I didn't document this in the README, and ideally you shouldn't have to authenticate, but that's how GitHub packages works. Below are the GitHub docs on how to get past this issue:

https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#using-a-published-package

You need an access token to publish, install, and delete packages.

You can use a personal access token (PAT) to authenticate to GitHub Packages or the GitHub API. When you create a personal access token, you can assign the token different scopes depending on your needs. For more information about packages-related scopes for a PAT, see "About permissions for GitHub Packages."

..

Groovy

repositories {
    maven {
        url = uri("https://maven.pkg.github.com/OWNER/REPOSITORY")
        credentials {
            username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
            password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
        }
    }
}

Kotlin

repositories {
    maven {
        url = uri("https://maven.pkg.github.com/OWNER/REPOSITORY")
        credentials {
            username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
            password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN")
        }
    }
}

timrs2998 avatar Jan 18 '22 02:01 timrs2998