Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8c25b8d. Configure here.
| this.pendingAuthorizedData = data; | ||
| this.setState({ idToken: data.authTokenInfo.idToken }); | ||
| log.debug("authorized (buffered, pending consent)", this.connectedConnectorName); | ||
| return; |
There was a problem hiding this comment.
Consent flow loses accessToken and refreshToken
Medium Severity
When the AUTHORIZED event is buffered during CONSENT_REQUIRED state, only idToken is persisted via setState, omitting accessToken and refreshToken. The normal (non-consent) flow persists all three. Additionally, acceptConsent() emits the buffered AUTHORIZED event but never calls setState to persist these missing tokens, so they are permanently lost.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 8c25b8d. Configure here.


Motivation and Context
Introduces a consent gate that requires users to accept Terms and Conditions / Privacy Policy before completing the login flow. When
consentRequiredis enabled inuiConfig(along withtncLinkandprivacyPolicyURLs), the SDK pauses after wallet connection and prompts the user to accept or decline before proceeding.Jira Link:
https://consensyssoftware.atlassian.net/browse/EMBED-80
Description
New Connector Status:
CONSENT_REQUIREDCONSENT_REQUIREDtoCONNECTOR_STATUSandCONNECTOR_EVENTSconstants.CAN_LOGOUT_STATUSESto allow logout from the consent-required state.ConnectorEventsandWeb3AuthNoModalEventstypings with the new event.Core SDK (
no-modal)Web3AuthNoModal: AddedconsentRequiredflag,pendingConnectedData, andpendingAuthorizedDatafields to buffer connection/authorization data while awaiting user consent.connectToConnector: When consent is required, theconnectedevent handler now emitsCONSENT_REQUIREDinstead ofCONNECTED, and buffers theAUTHORIZEDevent data.acceptConsent(): New public method that resumes the login flow — transitions status fromCONSENT_REQUIREDtoCONNECTED/AUTHORIZED, connects plugins, and emits buffered events.logout(): Updated to allow logout fromCONSENT_REQUIREDstate, clearing any pending data.consentRequiredwhen restoring status fromidToken.Modal Manager (
modal)consentRequired,privacyPolicy, andtncLinkfromuiConfigin the constructor.onAcceptConsentandonDeclineConsentcallbacks toLoginModal.onAcceptConsentcallsacceptConsent();onDeclineConsentcallslogout()and closes the modal.UI Components (
modalUI layer)LoginModal: Listens for theCONSENT_REQUIREDconnector event and transitions modal to consent status. ExposesconsentRequiredflag. Forwards accept/decline handlers.WidgetContext: AddedhandleAcceptConsentandhandleDeclineConsentto the widget context.Root: Passes consent handlers and TnC/privacy links to theLoader. Hides footer links when consent screen is active.Loader: NewConsentRequiredStatussub-component renders the consent UI with accept/decline buttons, TnC link, and privacy policy link. Shown whenmodalStatus === CONSENT_REQUIRED.How has this been tested?
Screenshots (if appropriate):
Types of changes
Checklist:
Note
Medium Risk
Changes the core connection state machine and emitted events during login, which can affect existing integrations that rely on
connected/authorizedtiming and logout behavior. UI flow now blocks completion until user action, so regressions could strand users in an intermediate state if misconfigured.Overview
Adds an optional consent gate to the Web3Auth login flow: when
uiConfig.consentRequiredis enabled (andprivacyPolicy+tncLinkare provided), the SDK now pauses after wallet connection and emits a newconsent_requiredstatus/event instead of immediately finalizing login.Implements
CONSENT_REQUIREDacrossno-modalandmodal: core buffers pendingconnected/authorizeddata untilacceptConsent()is called (or allowslogout()from this state), while the modal UI renders a new consent screen with Accept/Decline actions wired throughLoginModal/WidgetContext/Loaderand hides footer links during the consent step.Reviewed by Cursor Bugbot for commit 9108c09. Bugbot is set up for automated code reviews on this repo. Configure here.