"401 Content access is protected by token" authentication failure while performing maven release

I ran into this as well. The instructions from @mben-soula worked for me –

  1. Go to https://s01.oss.sonatype.org/
  2. Go to profile
  3. Change the pulldown from “Summary” to “User Token”
  4. Click on “Access User Token”

I am using Gradle in my project, so I have all my credentials stored in a private gradle.properties file. Using the username and password values from the “Access User Token” popup, I created two new entries:

ossrhToken=...
ossrhTokenPassword=...

And finally, I updated my Gradle build script, shoud look something like this:

maven {
    credentials {
        username = findProperty("ossrhToken") as String
        password = findProperty("ossrhTokenPassword") as String
    }
}
4 Likes