Skip to content
This repository has been archived by the owner on Jan 16, 2018. It is now read-only.

CP_OAuth2网页授权

Daniel Qian edited this page Nov 28, 2014 · 1 revision

构造网页授权url

首先构造网页授权url,然后构成超链接让用户点击

wxCpService.oauth2buildAuthorizationUrl(null)

获得用户基本信息

当用户同意授权后,会回调所设置的url并把authorization code传过来,然后用这个code获得access token

String[] res = wxCpService.oauth2getUserInfo(code);
String userId = res[0];
String deviceId = res[1];