{"record":{"id":"d6298722df85324e","repo":"justauth/JustAuth","slug":"errmsg-d62987","errorCode":null,"errorMessage":"${errMsg}","messagePattern":"\\$\\{errMsg\\}","errorType":"exception","errorClass":"AuthException","httpStatus":null,"severity":"error","filePath":"src/main/java/me/zhyd/oauth/request/AuthAlipayRequest.java","lineNumber":210,"sourceCode":"            .code(AuthResponseStatus.SUCCESS.getCode())\n            .data(AuthToken.builder()\n                .accessToken(response.getAccessToken())\n                .uid(response.getUserId())\n                .expireIn(Integer.parseInt(response.getExpiresIn()))\n                .refreshToken(response.getRefreshToken())\n                .build())\n            .build();\n    }\n\n    @Override\n    public AuthUser getUserInfo(AuthToken authToken) {\n        String accessToken = authToken.getAccessToken();\n        AlipayUserInfoShareRequest request = new AlipayUserInfoShareRequest();\n        AlipayUserInfoShareResponse response = null;\n        try {\n            response = this.alipayClient.execute(request, accessToken);\n        } catch (AlipayApiException e) {\n            throw new AuthException(e.getErrMsg(), e);\n        }\n        if (!response.isSuccess()) {\n            throw new AuthException(response.getSubMsg());\n        }\n\n        String province = response.getProvince(), city = response.getCity();\n        String location = String.format(\"%s %s\", StringUtils.isEmpty(province) ? \"\" : province, StringUtils.isEmpty(city) ? \"\" : city);\n\n        return AuthUser.builder()\n            .rawUserInfo(JSONObject.parseObject(JSONObject.toJSONString(response)))\n            .uuid(response.getUserId())\n            .username(StringUtils.isEmpty(response.getUserName()) ? response.getNickName() : response.getUserName())\n            .nickname(response.getNickName())\n            .avatar(response.getAvatar())\n            .location(location)\n            .gender(AuthUserGender.getRealGender(response.getGender()))\n            .token(authToken)\n            .source(source.toString())","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/justauth/JustAuth/blob/694bbf1b010d93404e3bfb4824d90e9ddfaebebb/src/main/java/me/zhyd/oauth/request/AuthAlipayRequest.java#L192-L228","documentation":"Wraps an AlipayApiException raised by alipayClient.execute(request, accessToken) while fetching the user profile (AlipayUserInfoShareRequest) in public-key mode. Message is e.getErrMsg(); the original exception is chained as the cause.","triggerScenarios":"AuthAlipayRequest.getUserInfo where execute throws AlipayApiException: signature verification of the gateway response fails, the access token is malformed at the protocol level, or a network error occurs.","commonSituations":"Wrong alipayPublicKey (most common — sign/verify mismatch after key rotation); access token truncated or empty; firewall blocking api.alipay.com from the server.","solutions":["Check the AlipayApiException cause's errCode — isv.invalid-signature points to a key mismatch, HTTP errors point to network","Re-copy the Alipay open-platform public key into AuthConfig if keys were regenerated","Verify the access token is complete and was obtained from the same environment (sandbox vs prod)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (StringUtils.isEmpty(authToken.getAccessToken())) {\n    throw new IllegalStateException(\"access token required for alipay getUserInfo\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    return alipayRequest.getUserInfo(token);\n} catch (AuthException e) {\n    if (e.getCause() instanceof AlipayApiException) {\n        String errCode = ((AlipayApiException) e.getCause()).getErrCode();\n        log.warn(\"alipay userinfo api error {}\", errCode);\n    }\n    throw e;\n}","preventionTips":["Keep alipayPublicKey synced with open-platform key rotations","Fetch user info right after token acquisition","Distinguish AlipayApiException (transport/sign) from business failure (error 31) in handling"],"tags":["alipay","oauth","user-info","signature"],"backgroundTag":null,"analyzedSha":"694bbf1b010d93404e3bfb4824d90e9ddfaebebb","analyzedAt":"2026-08-14T15:16:59.945Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}