Skip to content

feat(authentication): add organization parameter to resetPassword - #1038

Open
NandanPrabhu wants to merge 3 commits into
mainfrom
feat/reset-password-organization
Open

feat(authentication): add organization parameter to resetPassword#1038
NandanPrabhu wants to merge 3 commits into
mainfrom
feat/reset-password-organization

Conversation

@NandanPrabhu

@NandanPrabhu NandanPrabhu commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an optional organization parameter to AuthenticationAPIClient.resetPassword, sent as the organization key in the dbconnections/change_password request body.

When set, Auth0 associates the password reset request with that organization, which makes organization_id and organization_name available in the reset redirect URL and as variables in customized email templates.

authentication
    .resetPassword("info@auth0.com", "my-database-connection", "org_abc123")
    .start(callback)

Additive only. The parameter defaults to null; when absent the request body is byte-identical to today's. No existing behaviour changes.

Test plan

  • ./gradlew testReleaseUnitTest jacocoTestReleaseUnitTestReport lintRelease --continue — BUILD SUCCESSFUL
  • 1444 tests, 0 failures, 0 skipped
  • Lint: 0 errors (24 warnings, all pre-existing and outside the changed lines)
  • auth0:compileReleaseKotlin passes explicit API mode (strict)
  • All 6 pre-existing resetPassword tests pass unmodified — confirms backward compatibility
  • @JvmOverloads 2-arg bridge confirmed present via javap

Summary by CodeRabbit

  • New Features
    • Password reset requests can now optionally include an organization ID.
    • Organization information is supported across asynchronous, synchronous, and coroutine-based password reset flows.
  • Documentation
    • Added password reset examples for Kotlin, coroutines, and Java.
    • Documented optional organization association and clarified that the value must be an organization ID.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

resetPassword now accepts an optional organization ID and includes it in the password reset request when provided. Tests cover async, synchronous, coroutine, null, omitted, and empty-string values. Documentation adds Kotlin, coroutine, and Java examples.

Changes

Password reset organization support

Layer / File(s) Summary
API request support
auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.kt
resetPassword accepts an optional organization parameter and conditionally adds it to the request.
Validation and documentation
auth0/src/test/java/com/auth0/android/authentication/AuthenticationAPIClientTest.kt, EXAMPLES.md
Tests cover organization handling across execution modes and input values. Documentation describes the new parameter and examples.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: documentation, review:small

Suggested reviewers: subhankarmaiti

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding an optional organization parameter to the resetPassword method in AuthenticationAPIClient.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/reset-password-organization

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@NandanPrabhu
NandanPrabhu marked this pull request as ready for review August 5, 2026 14:19
@NandanPrabhu
NandanPrabhu requested a review from a team as a code owner August 5, 2026 14:19

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@EXAMPLES.md`:
- Around line 1820-1827: Update the Kotlin example around the
AuthenticationException catch block to use the valid Throwable method name on e;
replace the current printStacktrace call with the standard printStackTrace
invocation so the snippet compiles when copied. Keep the rest of the
resetPassword example unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 06be18f4-3506-46e7-9570-6137fe5ff6d0

📥 Commits

Reviewing files that changed from the base of the PR and between f603638 and d645f0b.

📒 Files selected for processing (3)
  • EXAMPLES.md
  • auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.kt
  • auth0/src/test/java/com/auth0/android/authentication/AuthenticationAPIClientTest.kt

Comment thread EXAMPLES.md
Comment on lines +1820 to +1827
try {
authentication
.resetPassword("info@auth0.com", "my-database-connection", "org_abc123")
.await()
println("Password reset email sent")
} catch (e: AuthenticationException) {
e.printStacktrace()
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "EXAMPLES.md relevant snippet:"
sed -n '1800,1835p' EXAMPLES.md | cat -n

echo
echo "Java/Kotlin printStackTrace references in EXAMPLES.md:"
rg -n "printStack(trace|trace)" EXAMPLES.md || true

echo
echo "Check whether this repository contains Kotlin/JVM build config that could hint Kotlin API spelling expectations:"
git ls-files | rg '(^|/)(build\.gradle|build\.gradle\.kts|pom\.xml|examples|src)' | head -200

Repository: auth0/Auth0.Android

Length of output: 16139


🌐 Web query:

Kotlin Throwable printStackTrace documentation

💡 Result:

In Kotlin, the printStackTrace function is an extension method (or member function depending on the platform) available on the Throwable class [1][2][3]. Its primary purpose is to print a detailed description of the exception, including its stack trace, to the standard error output or a specified stream [1][2][3][4]. Key details regarding printStackTrace: Functionality: It outputs the exception's description and its associated backtrace [4]. When using the no-argument version, it typically prints to the standard error stream or console error output, depending on the platform (e.g., JVM, Native, JS) [2][3][4]. Overloads: - printStackTrace: Prints to the standard error output [1][2][3]. - printStackTrace(stream: PrintStream): Prints to the specified PrintStream [2][3][4]. - printStackTrace(writer: PrintWriter): Prints to the specified PrintWriter [2][3][4]. Important Considerations: - Output Stability: The official documentation notes that the format of the output produced by printStackTrace is not stable and may change in future versions [1][3]. - Alternative: For scenarios where you need to capture the stack trace as a String rather than printing it directly to an output stream, Kotlin provides the stackTraceToString function [5]. The stack trace itself is a report generated by the runtime environment that lists the sequence of function calls leading to where the exception occurred, which is essential for debugging [6]. On JVM platforms, this typically includes the exception type, thread information, error message, and stack frames (method names, file names, and line numbers) [6].

Citations:


Fix the Kotlin exception method name.

Use e.printStackTrace() with a capital T and an e at the end. printStacktrace() is not a valid Throwable method and this Kotlin example will not compile when copied.

Proposed fix
-    e.printStacktrace()
+    e.printStackTrace()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
try {
authentication
.resetPassword("info@auth0.com", "my-database-connection", "org_abc123")
.await()
println("Password reset email sent")
} catch (e: AuthenticationException) {
e.printStacktrace()
}
try {
authentication
.resetPassword("info@auth0.com", "my-database-connection", "org_abc123")
.await()
println("Password reset email sent")
} catch (e: AuthenticationException) {
e.printStackTrace()
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@EXAMPLES.md` around lines 1820 - 1827, Update the Kotlin example around the
AuthenticationException catch block to use the valid Throwable method name on e;
replace the current printStacktrace call with the standard printStackTrace
invocation so the snippet compiles when copied. Keep the rest of the
resetPassword example unchanged.

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.

1 participant