Skip to content

Implement Wix token persistence, refresh flow, and live API routes#492

Open
AJaySi wants to merge 1 commit into
mainfrom
codex/implement-real-token-logic-for-wix-routes
Open

Implement Wix token persistence, refresh flow, and live API routes#492
AJaySi wants to merge 1 commit into
mainfrom
codex/implement-real-token-logic-for-wix-routes

Conversation

@AJaySi
Copy link
Copy Markdown
Owner

@AJaySi AJaySi commented May 11, 2026

Motivation

  • Replace placeholder frontend-only Wix logic with server-backed token handling so routes can operate using persisted OAuth tokens and refresh flows.
  • Ensure publish, categories, tags, status and disconnect endpoints work with real Wix API calls and surface proper connection/site metadata.
  • Provide consistent HTTP error mapping for auth/permission/upstream failures.

Description

  • Added helpers _get_current_user_id, _resolve_valid_wix_token, and _map_wix_error to resolve current user, load/refresh persisted tokens via WixOAuthService and WixService.refresh_access_token, and map errors to 401/403/5xx HTTP responses.
  • Updated /connection/status and /status to return connected: true and live site_info/permission metadata using the resolved access token and wix_service.check_blog_permissions.
  • Implemented /publish to resolve member_id, call WixService.create_blog_post(...), persist refreshed tokens when applicable, and return canonical fields post_id, url, and publish_state.
  • Implemented /categories and /tags to proxy real responses from WixService.get_blog_categories and WixService.get_blog_tags using the resolved token.
  • Implemented /disconnect to revoke stored token records for the current user via WixOAuthService.revoke_token and return a disconnected status.

Testing

  • Ran python -m py_compile backend/api/wix_routes.py and it succeeded.
  • Code was committed (f2f8d98) after local validation; no additional automated integration/unit tests were executed in this rollout.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant