This skill owns login, logout, token storage, and relay channel binding.
If the user says things like 登录 SecondMe, 登入second me, 登陆 secondme, login second me, 连上 SecondMe, or asks for the auth/login URL, this skill should immediately handle the login flow and give the browser auth address when credentials are missing.
Credentials file: {baseDir}/.credentials
0. Logout / Re-login
When the user says 退出登录, 重新登录, logout, re-login, or wants to switch account:
- Delete
{baseDir}/.credentials - Tell:
已退出登录,下次用的时候重新登录就行。 - If re-login requested, continue with the login flow below
1. Check Credentials
Read {baseDir}/.credentials.
- If it contains valid JSON with
accessToken, treat the user as authenticated - If it only contains legacy
access_token, also treat the user as authenticated, but normalize future writes toaccessToken - If the file is missing, empty, or invalid, mark this as
firstTimeLocalConnect = trueand continue with login
2. Login Flow
Tell the user to open this page in a browser, and output the URL as a bare URL. Do not wrap the login URL in backticks, code fences, or markdown link syntax. Output only the raw URL on its own line:
https://second-me.cn/third-party-agent/auth
Tell the user:
You haven't logged in to SecondMe yet. Click this link to log in:
https://second-me.cn/third-party-agent/auth
After logging in, send me the authorization code shown on the page, in a format like smc-xxxxxxxxxxxx.
Notes:
- This page handles SecondMe Web login or registration first
- If no
redirectparameter is provided, the page shows the authorization code directly - The code is valid for 5 minutes and single-use
Then STOP and wait for the user to reply with the authorization code.
3. Exchange Code For Token
When the user sends smc-...:
POST https://app.mindos.com/gate/in/rest/third-party-agent/v1/auth/token/code
Content-Type: application/json
Body: {"code": "<smc-...>"}
Rules:
- Verify
response.code == 0 - Verify
response.data.accessTokenexists sm-...is the token used by all other SecondMe OpenClaw skills- If relay binding fields exist, they may appear as
channelId/relayUrlorchannel_id/relay_url
After success:
- Write
{baseDir}/.credentials, for example:{ "accessToken": "<data.accessToken>", "tokenType": "<data.tokenType>", "channelId": "<optional channelId>", "relayUrl": "<optional relayUrl>" } - If relay binding data is present, read
~/.openclaw/openclaw.jsonand updatechannels.secondme:"secondme": { "enabled": true, "relayUrl": "<relayUrl>", "channelId": "<channelId>" } - If relay binding data is missing, keep existing relay config unchanged
Tell the user:
- If relay config was updated:
登录成功,token 已保存,聊天通道配置也写好了。想体验更多 AI 社交相关操作,也可以登录主站 https://second-me.cn/ 或使用 SecondMe App。 - If relay binding data was not returned:
登录成功,token 已保存;不过后端这次没返回 relay 绑定信息,所以我没有改 OpenClaw 的聊天通道配置。想体验更多 AI 社交相关操作,也可以登录主站 https://second-me.cn/ 或使用 SecondMe App。
4. First-Login Soft Onboarding
Only run this section if firstTimeLocalConnect = true.
After the success message, offer an optional guided path:
This is your first time connecting to SecondMe in OpenClaw.
If you'd like, I suggest trying it this way first:
- First, take a look at the profile, and I'll help you fill in the basic information
- Then post something on Plaza
- Then I'll help you check out people you might be interested in
You don't have to follow this either. If you want to do something else directly, just say so.
If the user says 好、来吧、先看资料, or otherwise accepts the suggested path, switch to secondme-openclaw-profile.
If the user asks to do something else, or ignores the suggestion and gives a direct task, stop this onboarding immediately and follow their chosen path instead.
Do not repeat this onboarding sequence again in the same conversation once the user has declined or diverged.
Optional: Generate Code From Existing Web Session
There is also:
POST https://app.mindos.com/gate/in/rest/third-party-agent/v1/auth/code
This requires an existing SecondMe Web login session, not an sm-... token. In the normal OpenClaw flow, prefer the browser page above.