Skip to content

feat: amend login params for audit#472

Merged
chaitanyapotti merged 5 commits intomasterfrom
feat/track-auth-flow
Mar 31, 2026
Merged

feat: amend login params for audit#472
chaitanyapotti merged 5 commits intomasterfrom
feat/track-auth-flow

Conversation

@lwin-kyaw
Copy link
Copy Markdown
Contributor

@lwin-kyaw lwin-kyaw commented Mar 27, 2026

Jira Link

https://consensyssoftware.atlassian.net/browse/EMBED-226

Description

  • Added Citadel audit tracking for oauthInitiated and oauthFailed in the login flow.
  • Fixed the redirect flow so a generated recordId is persisted into args.customState before session creation, preventing a second recordId from being generated after getRedirectResult().
  • Passed recordId and authConnection through to Torus key retrieval so the same audit context is preserved through completion.
  • Added a callCitadelAuditApi() helper to send audit events to the Citadel endpoint.
  • Expanded unit tests to cover redirect round-trip behavior and verify recordId reuse.

How has this been tested?

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the code style of this project. (run lint)
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Note

Medium Risk
Changes the login flow’s error propagation and extends Torus share retrieval inputs (recordId, authConnection), which could affect redirect/popup login behavior and downstream consumers relying on previous error types/messages.

Overview
Improves the login flow by catching failures during redirect/popup handling in triggerLogin and rethrowing them as a dedicated CustomAuthLoginError with a stable CustomAuthLoginErrorPrefix.

Extends Torus key retrieval by passing through additional audit context (recordId from customState and the resolved authConnection) into retrieveShares, and bumps @toruslabs/torus.js to ^17.2.3. Adds unit tests covering the new error type/prefix and the wrapped-error behavior, plus minor repo hygiene updates (.gitignore adds .npmrc).

Written by Cursor Bugbot for commit bfb9f26. This will update automatically on new commits. Configure here.

@lwin-kyaw lwin-kyaw requested a review from a team as a code owner March 27, 2026 11:23
@lwin-kyaw lwin-kyaw changed the title feat: track 'oauthFailed', 'oauthInitiated' event for audit feat: amend login params for audit Mar 30, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@chaitanyapotti chaitanyapotti merged commit b0144a6 into master Mar 31, 2026
5 checks passed
@chaitanyapotti chaitanyapotti deleted the feat/track-auth-flow branch March 31, 2026 06:48
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