Skip to content

Refresh Hub license token via API with captcha#143

Merged
tobihagemann merged 4 commits intodevelopfrom
feature/migrate-hub-subscriptions-to-api
Feb 27, 2026
Merged

Refresh Hub license token via API with captcha#143
tobihagemann merged 4 commits intodevelopfrom
feature/migrate-hub-subscriptions-to-api

Conversation

@tobihagemann
Copy link
Member

@tobihagemann tobihagemann commented Feb 7, 2026

⚠️ DO NOT MERGE YET. We need to make sure that API/Store are ready and associated PRs are merged first.

The billing page now refreshes the Hub license token through the /licenses/hub/refresh API endpoint instead of exposing it directly from the store response. A captcha challenge is required before the token is issued, and on checkout/modification flows the user is redirected back to Hub automatically. If the refresh fails, a Retry button lets the user re-trigger the captcha and try again (using x-if to fully recreate the widget). Also extracts the captcha widget into the reusable captcha.html partial and fixes Paddle passthrough JSON serialization.

Instead of using the store's token directly, the billing page now
refreshes the license token through the /licenses/hub/refresh API
endpoint with captcha verification. On normal visits the token is
displayed inline; on checkout/modification flows the user is
redirected back to Hub. Also extracts captcha widget into a reusable
partial and fixes Paddle passthrough JSON serialization.
Show a Retry button when the license token refresh fails, allowing
the user to re-trigger the captcha and refresh flow. Switch the
captcha container from x-show to x-if so the ALTCHA widget is fully
destroyed and recreated on retry, guaranteeing a fresh challenge.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 366e96a and 3635467.

📒 Files selected for processing (2)
  • i18n/de.yaml
  • i18n/en.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • i18n/en.yaml
  • i18n/de.yaml

Walkthrough

Introduces a license token refresh workflow: adds REFRESH_LICENSE_URL and HubSubscription.refreshToken() that POSTs a captcha-verified request to refresh verification tokens, updates state flags (needsTokenRefresh, shouldTransferToHub), and conditionally triggers transfer after refresh. Replaces direct token usage with verificationToken across load/post/put flows. UI updates expose captcha-driven refresh states and replace inline captcha widgets with a reusable captcha partial supporting onVerified callbacks. Adds i18n entries for a retry action and tweaks generate-pay-link payload formatting.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~23 minutes

Suggested reviewers

  • overheadhunter
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: refreshing Hub license token via API with captcha verification, matching the core functionality added across the changeset.
Description check ✅ Passed The description is directly related to the changeset, explaining the token refresh mechanism, captcha requirement, API endpoint, transfer flow, retry functionality, and related fixes in detail.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/migrate-hub-subscriptions-to-api

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@layouts/hub-billing/single.html`:
- Around line 179-194: The "Retry" button is shown even when the captcha is
auto-started because x-show only checks subscriptionData.token; update the Retry
button's visibility to also require that the captcha is not active (e.g. change
its x-show to !subscriptionData.token && !subscriptionData.needsTokenRefresh) so
it is hidden while subscriptionData.needsTokenRefresh is true, or alternatively
keep it visible but change its label logic to a generic action when
subscriptionData.needsTokenRefresh is true; adjust the button that currently
references subscriptionData.token and subscriptionData.needsTokenRefresh
accordingly (the button with `@click.prevent` setting
subscriptionData.errorMessage = ''; subscriptionData.needsTokenRefresh = true).

@tobihagemann tobihagemann merged commit 21579df into develop Feb 27, 2026
5 checks passed
@tobihagemann tobihagemann deleted the feature/migrate-hub-subscriptions-to-api branch February 27, 2026 15:05
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