集成sdk的操作这里就不讲了,可以去微信开发者平台查看文档。
1.通过微信授权接口在微信回调里获取授权信息,一般会提供openID给服务器查询微信是否绑定过,如果绑定过服务器会返回用户信息直接登录
//进行微信授权
SendAuthResp *authResp = (SendAuthResp *)resp;
NSDictionary *wxParam = @{@"appid":wxKey,
@"secret":wxSecretKey,
@"code":authResp.code,
@"grant_type":@"authorization_code"
};
AFHTTPSessionManager *session = [AFHTTPSessionManager manager];
session.responseSerializer = [AFHTTPResponseSerializer serializer];
[session POST:@"https://api.weixin.qq.com/sns/oauth2/access_token?" parameters:wxParam progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSDictionary *dict = [NSJSONSerialization