WeChat.Plug.CheckOauth2 (wechat v0.6.3)
检查是否有网页授权
Usage
plug WeChat.Plug.CheckOauth2, client: Client
可选参数:
:oauth2_callback_path
: 默认值为"/wx/oauth2/callback"
:need_code_name
: 默认值为false
,oauth2_callback_path
是多个应用的话,请设置为true
, 如上面的配置:oauth2_callback_path
已经包含code_name
,:need_code_name
请不要设置为true
:env
:Client
的server_role=hub_client
时,可以配置此env
:scope
:"snsapi_base"
|"snsapi_userinfo"
, 默认值为"snsapi_base"
:state
: 默认值为""
注意 : 服务器角色为 hub_client
时,请确保已经配置 hub_url
:
WeChat.set_hub_url(Client, "https://wx.example.com")
检测到未授权将会跳转到下面这个链接:
"/wx/oauth2/callback/*path?xx=xx"
# or
"/wx/oauth2/:code_name/callback/*path?xx=xx"
# or
HubUrl <> "/wx/oauth2/:code_name/:env/callback/*path?xx=xx"
Link to this section Summary
Link to this section Functions
Link to this function
client_oauth2(conn, client, oauth2_callback_path, scope, state)
Link to this function