【发布时间】:2022-07-20 02:46:36
【问题描述】:
我已经从 Github 和示例 Java 中成功执行了一个示例代码,我可以通过调用来获取信封
OAuthToken accessToken = apiClient.requestJWTUserToken(INTEGRATOR_KEY, USER_ID, scopes, privateKeyBytes, 3600);apiClient.setAccessToken(accessToken.getAccessToken(), accessToken.getExpiresIn());
UserInfo userInfo = apiClient.getUserInfo(accessToken.getAccessToken());
它工作正常。但是当我尝试通过导入示例示例中提供的一些包并尝试使用以下代码创建端点来在 Springboot 中进行复制时 但是有了这段代码,我得到了
{"error": "unauthorized","error_description": "Full authentication is required to access this resource"}`.
在 SpringBoot 应用程序中使用 requestJWTUserToken 的 JWT 授权的完整身份验证过程/设置的任何示例代码?
import com.docusign.esign.client.ApiException;
import com.docusign.esign.model.Envelope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.List;
@RestController
@RequestMapping(DocuSignServiceController.BASE_URI)
class DocuSignServiceController {
static final String BASE_URI = "/docusign";
DocuSignService docuSignService;
public DocuSignServiceController(DocuSignService docuSignService) {
this.docuSignService = docuSignService;
}
@GetMapping("/get-envelopes")
public List<Envelope> getAllEnvelopes(
@RequestParam(value = "email", defaultValue = "false") String email) throws ApiException, IOException {
return docuSignService.getAllEnvelopes(email);
}
@GetMapping("/get-single-envelope")
public Envelope getSingleEnvelopesById(
@RequestParam(value = "envelopeId", defaultValue = "false") String envelopeId)
throws ApiException {
return docuSignService.getEnvelopeByID(envelopeId);
}
@GetMapping("/get-document-url")
public String getDocumentUrl(
@RequestParam(value = "envelopeId", defaultValue = "false") String envelopeId,
@RequestParam(value = "email", defaultValue = "false") String email)
throws ApiException {
return docuSignService.getDocumentUrl(envelopeId, email);
}
}
【问题讨论】:
-
“有人可以分享一个示例代码吗” -- 抱歉,这里是题外话。请阅读How to Ask
-
我已经改成文字了。谢谢
-
对 requestJWTUserToken() 的调用正在使用 DocuSign.eSign maven 包。是springboot还是什么都没关系。这里的问题必须是配置和您传递给此调用的数据。如果您将相同的确切信息传递给此电话(请三重检查)并且它在一个而不是另一个中起作用 - 您可能需要打开支持票
-
我添加了 Docusign.eSign maven 包。我认为您是对的,我缺少与配置相关的内容。
标签: java spring-boot docusignapi