跳到主内容

Add WeCom as an OAuth provider

This guide explains how to let users sign in to Casdoor from the WeCom (WeChat Work) client. You can connect an internal application or a third-party application of WeCom.


Learning outcomes​

  • Choose the sub type, the method, and the scope.
  • Add WeCom as an OAuth provider in Casdoor.

What you need​


Add the provider in Casdoor​

  1. In the Casdoor admin console, go to Identity > Providers and add a provider.

  2. Set Category to OAuth and Type to WeCom.

  3. Fill in the fields:

    字段描述
    Sub type内部或第三方
    Method静默或正常模式
    Client ID企业 CorpID
    Client secret企业 CorpSecret
    Agent ID应用 AgentId
    作用域snsapi_userinfo (default) or snsapi_privateinfo
  4. Save the provider.

Methods​

MethodBehavior
SilentWeCom redirects the user to redirect_uri?code=CODE&state=STATE without asking
NormalWeCom shows a consent page and redirects after the user agrees

见 企业微信 OAuth。

Scopes​

范围Data
snsapi_userinfoThe basic profile, without the email address
snsapi_privateinfoAlso the email address and other sensitive data. The administrator of the enterprise must grant the application the permission for sensitive member information

Use snsapi_privateinfo if Casdoor should fill in the email address of users from WeCom.

Next steps​

Add the provider to an application. See Add providers to an application.

See also​