You can first download and run the Open Platform
demo.
Switch to Browser extension at the top of the page, then follow this
guide.
1. Install the extension
Follow the extension installation guide to install the AiToEarn browser extension.2. Choose Authorize Only
Open the extension sidebar and select Authorize Only. Users do not need to sign in to an AiToEarn web account in this mode.
Authorize Only skips the AiToEarn web-account sign-in; it does not disable
the Web API. After you authorize the web origin in the next step, that origin
can call login(), publish(), and the helper methods listed on this page.3. Configure an injectable domain
Under Allowed domains, enter the origin of the web page that will call the extension. For the local demo, enter:https://demo.example.com/. Enter one HTTP or HTTPS URL per line.
Select Confirm and authorize, then refresh the web page so the extension can inject window.AIToEarnPlugin.

4. Detect the extension and read the platform account
Check the global object, version, and permissions before reading the platform session from the current browser:login(platform) means “get the sign-in information for this publishing
platform.” It does not sign in to AiToEarn or open a platform login form. The
user must already be signed in to the target platform in the same browser. The
Promise rejects if the platform session is missing or expired.5. Publish content
The following example publishes a local video to Xiaohongshu and receives download, upload, and publishing progress:video, cover, and images accept either browser File objects or accessible HTTP/HTTPS URLs. Image-post example:
Methods available in Authorize Only mode
After an injectable origin is configured, the following Web APIs are available inAuthorize Only mode:
Basic method parameters and responses
checkPermission()
This method takes no arguments and returns:
getVersion()
This method takes no arguments and returns:
login(platform)
platform must be xhs, wxSph, or douyin. A successful call returns:
The Promise rejects with an
Error on failure. Some errors also include code and errorCode.
publish() parameters
Call signature:
params fields:
LocationInfo has the following shape:
platformConfig:
Platform differences
Platform rules may change. Show validation and publishing errors returned by the extension to the user instead of silently ignoring them.
Publishing progress callback
onProgress receives a ProgressEvent on each update:
Stage-specific
data:
Publishing response
publish() resolves to a PublishResult:
Communication failures, timeouts, and some platform errors can reject the Promise directly. Handle both the result and
catch:
Location and WeChat Channels helpers
Location search
location field in publish(). For WeChat Channels, map the complete location item to platformConfig.wxSph.poiInfo when you need platform-specific fields such as poiCheckSum.
WeChat Channels activities and work URLs
wxSphSearchActivity() to platformConfig.wxSph.event. If WeChat Channels does not immediately return a work URL, use fields such as mediaMd5sum from platformData to start link polling. platformData is platform-specific, so confirm that each field exists before reading it.
Interaction methods
These methods are also available inAuthorize Only mode, but they are not required for publishing:
needHumanAssist is true, stop automatic retries and show verificationReason so the user can take over.
Troubleshooting
window.AIToEarnPluginis missing: confirm that the extension is installed and the current origin is in Allowed domains, then refresh the page. If the extension is not installed, link users tohttps://docs.aitoearn.ai/en/use/plugin-publish.login()is unavailable after Authorize Only: use the latest extension version that includeslogin()in the allowlist, and refresh the page after changing the domain configuration.- Account check failed: sign in to the target platform in the same browser, then call
login(platform)again. - Publishing failed: show the rejected Promise,
failReason, anderrorCode, then check the media URL, platform session, content type, and cover requirements. - No work URL is returned immediately: persist the
workIdfirst. For WeChat Channels, start link polling withwxSphStartLinkPolling()as described above.

