我有appid,secret和code,但是我为什么请求不了https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code
头疼,搞了一上午了
我有appid,secret和code,但是我为什么请求不了https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code
头疼,搞了一上午了
@yanfch 你的第一步是我们客户端做的事情,他把code告诉我了,然后我直接去请求https://api.weixin.qq.com/sns/oauth2/access_token,会这个错:unable to verify the first certificate
@yanfch 貌似是不让我请求这个url,只能请求一级域名,但是用别的语言就可以,或者可以直接在浏览器打开
dd
@racyily 请求模块用的哪个?
这是我之前请求的用的
function authorize(code, cb) {
const params = {
appid: app.appid,
secret: app.secret,
grant_type: 'authorization_code',
code: code
}
const opts = {
url: url.auth.authorize,
qs: params,
json: true
}
request.get(opts, function(err, res, body){
if (err) cb(err, body)
cb(null, body)
})
}