alipay icon indicating copy to clipboard operation
alipay copied to clipboard

SystemOauthToken 接口报错 invalid certificate

Open changcz opened this issue 1 year ago • 10 comments

调用 PublicAppAuthorize 接口 接受回调 auth_code

changcz avatar Jan 24 '24 05:01 changcz

client, err := alipay.New(appid,秘钥,true)

changcz avatar Jan 24 '24 05:01 changcz

var p = alipay.SystemOauthToken{}
p.GrantType = "authorization_code"
p.Code = authCode
token, err := client.SystemOauthToken(p)   

changcz avatar Jan 24 '24 05:01 changcz

咨询过支付宝技术服务中心 提供了 appid 帮我查了之后 说调用alipay.system.oauth.token是成功的

changcz avatar Jan 24 '24 05:01 changcz

我也是,这个有问题

heiwa9 avatar Apr 18 '24 07:04 heiwa9

咨询过支付宝技术服务中心 提供了 appid 帮我查了之后 说调用alipay.system.oauth.token是成功的

需要在调用前加载支付宝公钥 aliPayKey :="------------" client.LoadAliPayPublicKey(aliPayKey) 然后再: client.SystemOauthToken(alipay.SystemOauthToken) 就ok了

taisoulx avatar Apr 26 '24 11:04 taisoulx

client.LoadAliPayPublicKey(aliPayKey) 这个我确定是加载过了的,但是还是不行

heiwa9 avatar May 09 '24 01:05 heiwa9

runtime error: invalid memory address or nil pointer dereference /usr/Local/go/src/runtime/panic.go:261 (0x10e8ca8b7) panicmem: panic (memoryError) /usr/local/go/src/runtime/signal_unix.go:881 (0x10e8ca885) sigpanic: panicmemo /Users/song/go/pkg/mod/github.com/smartwalle/alipay/v30v3.2.19/alipay.go:378 (0x10f8493df) (*Client). doRequest: var req = ngx.NewRequest(method, c.host, ngx. WithClient(c.Client)) /Users/song/go/pkg/mod/github.com/smartwalle/alipay/v30v3.2.19/authorize.go:32 (0x10f97c624) (*Client). System0authToken: err = c. doRequest("POST", param, &result) /Users/song/XDSK/weblink/service/biz/biz_alipay_applet.go:34 (0x10f97c58a) (*AliAppletService).AlipayAuth: res0, err := a.cli.System0authToken(alipay.System0authTokent /Users/song/DSK/weblink/api/v1/biz/biz_alipay_applet.go:30 (0x10fddd0c8) (*AlipayAppletApi) AlipayAuthorization: auth, err := aliAppletService.AlipayAuth(info.AuthToken) /Users/song/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x10f43668a) (*Context) Next: c.handlersc.index /Users/song/XDSK/weblink/middleware/cors.go:26 (0x10fe9c86e) Routers.Cors.func3: c.Next /Users/song/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x10f43668a)

heiwa9 avatar May 09 '24 01:05 heiwa9

aliPayKey

你的 aliPayKey 是哪里来的

smartwalle avatar May 10 '24 01:05 smartwalle

咨询过支付宝技术服务中心 提供了 appid 帮我查了之后 说调用alipay.system.oauth.token是成功的

需要在调用前加载支付宝公钥 aliPayKey :="------------" client.LoadAliPayPublicKey(aliPayKey) 然后再: client.SystemOauthToken(alipay.SystemOauthToken) 就ok了

哥们,你有用这个接口吗?是否有问题?

smartwalle avatar May 10 '24 04:05 smartwalle

aliPayKey

你的 aliPayKey 是哪里来的

已经解决了,是我自己的代码问题,导致没有初始化就用它了。

heiwa9 avatar May 10 '24 04:05 heiwa9