跳转到内容

Auth

此内容尚不支持你的语言。

POST /v1/accounts/{a}/auth/disconnect

Close the connection to WeChat but keep the saved login trust.

Scope: login

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.

POST /v1/accounts/{a}/auth/login

Start signing the account in with a saved device or a QR code. Poll the returned operation.

Scope: login

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
Idempotency-KeyheaderstringRepeating a request with the same key returns the original result instead of repeating the work.

Request body: LoginRequest

Response: NativeOperation

POST /v1/accounts/{a}/auth/logout-local

Sign the account out on this daemon only, without asking WeChat to revoke the login.

Scope: login

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.

POST /v1/accounts/{a}/connect

Connect the signed-in account to WeChat. Poll the returned operation.

Scope: login

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.

POST /v1/accounts/{a}/disconnect

Close the connection to WeChat but keep the saved login trust.

Scope: login

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.

POST /v1/accounts/{a}/forget-credentials

Delete the saved login credentials of the account. The body must confirm.

Scope: login

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
Idempotency-Key (required)headerstringRepeating a request with the same key returns the original result instead of repeating the work.

Request body: NativeForgetRequest

POST /v1/accounts/{a}/login-attempts

Start signing the account in with a saved device or a QR code. Poll the returned operation.

Scope: login

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
Idempotency-KeyheaderstringRepeating a request with the same key returns the original result instead of repeating the work.

Request body: LoginRequest

Response: NativeOperation

DELETE /v1/accounts/{a}/login-attempts/{id}

Cancel a login attempt.

Scope: any valid token

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
id (required)pathstringLogin attempt ID.

Response: NativeOperation

GET /v1/accounts/{a}/login-attempts/{id}

Show the state of a login attempt.

Scope: any valid token

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
id (required)pathstringLogin attempt ID.

Response: NativeOperation

POST /v1/accounts/{a}/login-attempts/{id}/cancel

Cancel a login attempt.

Scope: any valid token

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
id (required)pathstringLogin attempt ID.

Response: NativeOperation

GET /v1/accounts/{a}/login-attempts/{id}/qr

Get the current QR code of a login attempt as a PNG image.

Scope: login

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
id (required)pathstringLogin attempt ID.
generationqueryinteger, nullableOnly return the QR code if it is still this generation. A newer code fails with login_challenge_superseded.

POST /v1/accounts/{a}/logout

Sign the account out of WeChat. Poll the returned operation.

Scope: login

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
Idempotency-Key (required)headerstringRepeating a request with the same key returns the original result instead of repeating the work.

GET /v1/accounts/{a}/operations/{id}/qr

Get the current QR code of a login operation as a PNG image.

Scope: login

ParameterInTypeDescription
a (required)pathstringAccount ID or alias.
id (required)pathstringOperation ID.
generationqueryinteger, nullableOnly return the QR code if it is still this generation. A newer code fails with login_challenge_superseded.

Types

LoginRequest

Options for signing an account in. Every field is optional.

FieldTypeDescription
allowQrbooleanWhether a QR code may be shown. When false, only a saved login can be used. The default is true.
computerNamestringName this computer gives WeChat while signing in, up to 100 characters. The default is agent-wechat.
forceQrbooleanTrue to skip the saved login and use a QR code, the same as strategy qr. The default is false.
qrRefreshQrRefreshHow an expired QR code is replaced.
strategyLoginStrategyHow to sign in. The default is auto.
timeoutSecondsintegerHow long to wait for the sign-in to finish, from 10 to 900 seconds. The default is 300.

LoginStrategy

How to sign in.

ValueDescription
”auto”Use the saved login if there is one, and fall back to a QR code if it is missing or rejected.
”saved-device”Use only the saved login. If it cannot be used, the attempt ends as needs_login without showing a QR code.
”qr”Always sign in by scanning a QR code.

NativeForgetRequest

Request to delete the account’s saved login credentials.

FieldTypeDescription
confirm (required)booleanMust be true. It confirms that the credentials should be deleted.

NativeOperation

A background operation such as signing in or out, refreshing contacts or changing a group. Poll it by ID until it finishes.

FieldTypeDescription
accountId (required)stringID of the account the operation belongs to.
createdAt (required)stringWhen the operation was created, as an RFC 3339 time.
id (required)stringOperation ID.
kind (required)stringWhat the operation does, such as login, logout, sync, metadata, group_mutation, message_recall or media-writeback.
result (required)anyDetails of the outcome. Its fields depend on kind, and it is empty until the operation has something to report.
state (required)stringWhere the operation stands, such as queued, running, succeeded, failed or cancelled. Some kinds report more states, for example needs_review, or awaiting_scan and awaiting_approval during a login.
updatedAt (required)stringWhen the operation last changed, as an RFC 3339 time.

QrRefresh

How an expired QR code is replaced.

FieldTypeDescription
maxRefreshesintegerHow many times to replace an expired QR code automatically, from 0 to 3. The default is 3.
modeQrRefreshModeWhether an expired QR code that nobody scanned is replaced automatically. The default is auto.

QrRefreshMode

Whether an expired QR code is replaced automatically.

ValueDescription
”auto”Replace an expired, unscanned QR code with a new one, up to the refresh limit.
”manual”Do not replace it. An expired QR code ends the attempt as expired.