timrs2998 / pdf-builder

PDF builder written in Kotlin with a statically typed DSL
https://timrs2998.github.io/pdf-builder/
GNU General Public License v3.0
58 stars 16 forks source link

Unauthorized error #32

Open chavu opened 2 years ago

chavu commented 2 years ago

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

timrs2998 commented 2 years ago

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")
        }
    }
}