Skip to content

Commit

Permalink
Change the Authorization header to use Bearer (#748)
Browse files Browse the repository at this point in the history
While Maven Central does support the UserToken header they recommend using the standard Bearer value, as future versions of the API might drop support for UserToken

https://central.sonatype.org/publish/publish-portal-api/#authentication-authorization
  • Loading branch information
jordond committed Mar 28, 2024
1 parent a3cdbdb commit 521bc03
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal class SonatypeCentralPortalOkHttpInterceptor(
val requestBuilder = chain.request().newBuilder()

requestBuilder.addHeader("Accept", "application/json") // request json by default, XML is returned else
requestBuilder.addHeader("Authorization", "UserToken $usertoken")
requestBuilder.addHeader("Authorization", "Bearer $usertoken")
requestBuilder.addHeader("User-Agent", "$userAgentName/$userAgentVersion")

return chain.proceed(requestBuilder.build())
Expand Down

0 comments on commit 521bc03

Please sign in to comment.