`401 Content access is protected by token` even though I'm using my token

I have an existing project that publishes to oss.sonatype.org. I’ve accessed my token, stored it in my private gradle.properties, and replaced my old username / password configuration with:

    maven {
      name = "nexus"
      url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
      credentials {
        username = findProperty("ossrhToken") as String
        password = findProperty("ossrhTokenPassword") as String

but I still get Received status code 401 from server: Content access is protected by token. I don’t understand what I’m missing.

Do I need to start publishing via s01.oss.sonatype.org? I don’t have account credentials there and my understanding was existing projects keep using the original server.


Hi this is the wrong forum for the discussion, this is is for Nexus Repository as a product.

I believe you want the Central Repository forum.