wecom_auth_plus 0.0.7 copy "wecom_auth_plus: ^0.0.7" to clipboard
wecom_auth_plus: ^0.0.7 copied to clipboard

Flutter plugin for WeCom (Enterprise WeChat) auth. Supports configure, app-installed check, register, auth, and auto login flow.

wecom_auth_plus #

A Flutter plugin for WeCom (Enterprise WeChat) auth/login flows.

Features #

  • configure(scheme, corpId, agentId)
  • isAppInstalled()
  • register()
  • auth(state)
  • resetAuth()
  • authLoginAuto(...)

Installation #

dependencies:
  wecom_auth_plus: ^0.0.7

Quick Start #

final plugin = WecomAuthPlus();

final result = await plugin.authLoginAuto(
  scheme: 'wwauth_your_corpid_agentid',
  corpId: 'wwxxxxxxxxxxxxxxxx',
  agentId: '1000004',
  state: 'tenant_a',
);

if (result.success) {
  final authCode = result.authCode;
  // Send authCode to your backend for WeCom user binding/login.
} else {
  debugPrint('WeCom auth failed: ${result.code} ${result.message}');
}

API #

  • configure(scheme, corpId, agentId)
  • isAppInstalled()
  • register({scheme, corpId, agentId})
  • auth({state})
  • resetAuth()
  • authLoginAuto({scheme, corpId, agentId, state})

Returned Fields #

WeComAuthResult includes:

  • success: whether current step succeeds
  • code: plugin-level result code
  • message: user-facing message
  • errCode: native WeCom err code when available
  • authCode: authorization code when successful
  • state: state returned by callback
  • raw: original map from native side

Android Setup Notes #

  • Ensure WeCom app is installed on test device.
  • Ensure your package name and app signature SHA1 are configured in WeCom open platform.
  • Ensure scheme / corpId / agentId exactly match WeCom platform settings.
  • Ensure callback is routed back to your app (scheme-based intent).

Plugin itself already declares:

  • <queries><package android:name="com.tencent.wework"/></queries>

iOS Setup Notes #

In your iOS app Info.plist:

  • Add your callback URL scheme (same as scheme passed to plugin).
  • Add LSApplicationQueriesSchemes containing wxwork and wxworklocal.
  • Ensure WeCom platform config matches your bundle id and scheme exactly.

Troubleshooting #

last auth request is still pending #

If the previous WeCom auth flow was interrupted or returned abnormally, call:

await plugin.resetAuth();

authLoginAuto(...) already does this automatically in 0.0.7+.

sendMessage returned false (Android) #

Usually means request cannot be accepted by WeCom SDK environment. Check:

  • WeCom installed on device.
  • Open-platform whitelist/signature/package config matched.
  • scheme / corpId / agentId matched.

errCode = 5 / auth_failed #

Usually an authorization rejection or environment mismatch:

  • Check tenant app permissions in WeCom admin console.
  • Verify callback scheme and app signature.
  • Confirm account is allowed to use current WeCom app/agent.

Notes #

  • This plugin focuses on auth-chain integration and callback parsing.
  • Final account binding/login should be completed by your backend using authCode.
1
likes
140
points
432
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for WeCom (Enterprise WeChat) auth. Supports configure, app-installed check, register, auth, and auto login flow.

Homepage

Topics

#wecom #enterprise-wechat #authentication #login

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on wecom_auth_plus

Packages that implement wecom_auth_plus