feat(authentication): add organization parameter to resetPassword - #1038
feat(authentication): add organization parameter to resetPassword#1038NandanPrabhu wants to merge 3 commits into
Conversation
📝 WalkthroughWalkthrough
ChangesPassword reset organization support
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
EXAMPLES.mdauth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.ktauth0/src/test/java/com/auth0/android/authentication/AuthenticationAPIClientTest.kt
| try { | ||
| authentication | ||
| .resetPassword("info@auth0.com", "my-database-connection", "org_abc123") | ||
| .await() | ||
| println("Password reset email sent") | ||
| } catch (e: AuthenticationException) { | ||
| e.printStacktrace() | ||
| } |
There was a problem hiding this comment.
🎯 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 -200Repository: 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:
- 1: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/print-stack-trace.html
- 2: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/
- 3: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/print-stack-trace.html
- 4: https://developer.android.com/reference/kotlin/java/lang/Throwable?authuser=1
- 5: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/stack-trace-to-string.html
- 6: https://kotlinlang.org/docs/exceptions.html
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.
| 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.
Summary
Adds an optional
organizationparameter toAuthenticationAPIClient.resetPassword, sent as theorganizationkey in thedbconnections/change_passwordrequest body.When set, Auth0 associates the password reset request with that organization, which makes
organization_idandorganization_nameavailable 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 SUCCESSFULauth0:compileReleaseKotlinpasses explicit API mode (strict)resetPasswordtests pass unmodified — confirms backward compatibility@JvmOverloads2-arg bridge confirmed present viajavapSummary by CodeRabbit