Skip to content

Upgrade OkHttp to 5.0.0 and Kotlin to 2.2.0 and removed @ignore testcases.#911

Open
utkrishtsahu wants to merge 5 commits intov4_developmentfrom
upgrade-okhttp-5x
Open

Upgrade OkHttp to 5.0.0 and Kotlin to 2.2.0 and removed @ignore testcases.#911
utkrishtsahu wants to merge 5 commits intov4_developmentfrom
upgrade-okhttp-5x

Conversation

@utkrishtsahu
Copy link
Contributor

@utkrishtsahu utkrishtsahu commented Feb 12, 2026

Changes

Internal dependency upgrade

This PR upgrades the SDK's internal HTTP client library OkHttp from 4.12.0 to 5.0.0 and the Kotlin compiler from 2.0.21 to 2.2.0 (required for OkHttp 5.x metadata compatibility).

Endpoints added, deleted, deprecated, or changed

None. All Auth0 API endpoints remain unchanged.

Classes and methods added, deleted, deprecated, or changed

  • No classes or methods added, deleted, deprecated, or changed in the public API.
  • OkHttp is declared as implementation scope — it is not exposed transitively to consumers.
  • Two internal call sites in WebAuthProvider.kt and OidcUtils.kt had toLowerCase(Locale.ROOT) replaced with lowercase(Locale.ROOT) due to Kotlin 2.2.0 promoting this deprecation to an error. These are private/internal methods with no public surface impact.

Test infrastructure migration

  • Migrated from okhttp3.mockwebserver → mockwebserver3 package (new artifact in OkHttp 5.x)
  • Adapted to MockResponse.Builder() pattern (immutable responses)
  • RecordedRequest.path → .target, getHeader() → headers[], shutdown() → close()
  • Null-safe body handling (ByteString? instead of Buffer)
  • Re-enabled 2 @ignore'd tests in WebAuthProviderTest.kt that now pass with OkHttp 5.x

References

SDK-7768

Testing

Build Passed
Unit Test Passed

Checklist

@utkrishtsahu utkrishtsahu requested a review from a team as a code owner February 12, 2026 03:22
@utkrishtsahu utkrishtsahu changed the title Upgrade OkHttp to 5.0.0 and Kotlin to 2.2.0; migrate tests to mockweb… Upgrade OkHttp to 5.0.0 and Kotlin to 2.2.0 and removed @ignore testcases. Feb 12, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades the SDK's internal dependencies: OkHttp from 4.12.0 to 5.0.0 and Kotlin from 2.0.21 to 2.2.0. The OkHttp 5.x upgrade requires Kotlin 2.2.0+ for metadata compatibility. The changes are primarily internal with no impact on the public API.

Changes:

  • Upgraded Kotlin compiler from 2.0.21 to 2.2.0
  • Upgraded OkHttp from 4.12.0 to 5.0.0
  • Migrated test infrastructure from okhttp3.mockwebserver to mockwebserver3 package
  • Replaced deprecated toLowerCase() with lowercase() in internal code
  • Re-enabled 2 previously @ignore'd tests in WebAuthProviderTest.kt
  • Updated V4_MIGRATION_GUIDE.md with Kotlin 2.2.0 and OkHttp 5.0.0 upgrade notes

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
build.gradle Updated Kotlin version to 2.2.0
auth0/build.gradle Updated OkHttp version to 5.0.0 and mockwebserver dependency to mockwebserver3
auth0/src/main/java/com/auth0/android/provider/WebAuthProvider.kt Replaced toLowerCase(Locale.ROOT) with lowercase(Locale.ROOT)
auth0/src/main/java/com/auth0/android/request/internal/OidcUtils.kt Replaced toLowerCase(Locale.ROOT) with lowercase(Locale.ROOT)
auth0/src/test/java/com/auth0/android/request/internal/ThreadSwitcherShadow.java Added mainThread() method implementation to match ThreadSwitcher interface
auth0/src/test/java/com/auth0/android/util/SSLTestUtils.kt Removed tunnelProxy parameter from useHttps() call (OkHttp 5.x API change)
auth0/src/test/java/com/auth0/android/util/APIMockServer.kt Migrated to mockwebserver3 package and MockResponse.Builder() pattern
auth0/src/test/java/com/auth0/android/util/AuthenticationAPIMockServer.kt Updated to use MockResponse.Builder() pattern
auth0/src/test/java/com/auth0/android/request/DefaultClientTest.kt Migrated to mockwebserver3 API (request.target, request.headers[], request.body?.utf8())
auth0/src/test/java/com/auth0/android/provider/WebAuthProviderTest.kt Re-enabled 2 tests with @ConscryptMode annotation and updated to use mocked networking clients
auth0/src/test/java/com/auth0/android/authentication/AuthenticationAPIClientTest.kt Migrated to mockwebserver3 API changes
auth0/src/test/java/com/auth0/android/authentication/MfaApiClientTest.kt Migrated to mockwebserver3 API changes
auth0/src/test/java/com/auth0/android/management/UsersAPIClientTest.kt Migrated to mockwebserver3 API changes
auth0/src/test/java/com/auth0/android/myaccount/MyAccountAPIClientTest.kt Migrated to mockwebserver3 API changes
V4_MIGRATION_GUIDE.md Added Kotlin 2.2.0 and OkHttp 5.0.0 upgrade documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
```

> **Note:** Kotlin 2.2.0 promotes the deprecation of `String.toLowerCase()` / `String.toUpperCase()` without a `Locale` parameter to an error. If your project uses these methods, replace them with `lowercase(Locale.ROOT)` / `uppercase(Locale.ROOT)`.
Copy link

@sanchitmehtagit sanchitmehtagit Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: We could remove this note, I think this note applies to users who have to update kotlin version and they may have more breaking changes in their code base to implement along with this while upgrading.https://kotlinlang.org/docs/compatibility-guide-22.html thoughts on this . or we could also add official doc for Kotlin 2.2.x for how to upgrade instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants