-
-
Notifications
You must be signed in to change notification settings - Fork 9k
CP_OAuth2网页授权
Binary Wang edited this page Jan 22, 2019
·
6 revisions
首先构造网页授权url,然后构成超链接让用户点击
WxCpService wxCpService = ...;
wxCpService.getOauth2Service().buildAuthorizationUrl(null);
当用户同意授权后,会回调所设置的url并把authorization code传过来,然后用这个code获得user id.
String[] res = wxCpService.getOauth2Service().getUserInfo(code);
String userId = res[0];
String deviceId = res[1];