HowTo: Authenticate to WeChat using GAM

Unofficial Content
This documentation is valid for:

This article explains how to authenticate your users with WeChat using GeneXus Access Manager (GAM).

1. Enter to the GAM's Backend and go to the Authentication Types section. Create a new OAuth 2.0 Authentication Type and define basic information in the General section: Name, Description, Images (optional), etc.

2. In the Configuration section you need to define, for the General, Authorization, Token and User Information tab, the following:


Client ID:     appid        Value: <appid>
Client Secret: secret    Value: <secret>
Redirect URL:  redirect_uri     Value: https://<server>/webapp


Response type TAG:  response_type      Value: code
Scope TAG:          scope              Value: snsapi_login
State TAG:          state
Include ClientID and RedirectURL
Additional parameters:
Access code TAG: code
Error description TAG: errmsg


Token Method: POST
Header Cotent type: Content-type      Value: application/x-www-form-urlencoded
Grant type:         grant_type        Value: authorization_code
Include Access Code:  True
Include Client Id:  True
Include Client Secret:  True
Include Redirect URL:  True
Access token TAG: access_token
Token type TAG:
Expires in TAG: expires_in
Scope Tag: scope
User Id Tag: openid
Refresh token Tag: refresh_token
Error Description Tag: errmsg

Refresh Token

Validate external token:  True
Refresh token URL:

User Information

Method: Post
Header Content type: Content-type      Value: application/json;charset=utf-8
Include Access Token:  True   Tag: access_token
Include Client Id:  False
Include Client Secret:  False
Include User Id:  True
Additional Parameters:  lang=en # Other options are zh_CN for Simplified Chinese, zh_TW for Traditional Chinese
User Email Tag:  unionid
User External Id Tag:  unionid
User Name Tag:  unionid
User First Name: nickname  Generate automatic Last Name:  True
User Language Tag: language
Error Description Tag: errmsg


As of GeneXus 15 Upgrade 11.

See Also

GAM - OAuth 2.0 Authentication Type