简体   繁体   English

简单的 Java OAuth 示例

[英]Simple Java OAuth example

I am trying to integrate Stripe (payment processor) with a Tomcat/JSP application.我正在尝试将 Stripe(支付处理器)与 Tomcat/JSP 应用程序集成。 They have a library for most of it except the initial OAuth2 connection.除了最初的 OAuth2 连接外,他们大部分都有一个库。

Not being a Java/Net programmer, I am having trouble getting my head around implementing the REST api in Java.不是 Java/Net 程序员,我很难理解用 Java 实现 REST api。

Their documentation does not cover Java very well but the cURL examples "should" be easy to work from.他们的文档没有很好地涵盖 Java,但是 cURL 示例“应该”很容易使用。

Basically I need to simulate this:基本上我需要模拟这个:

curl -X POST https://connect.stripe.com/oauth/token \
-H "Authorization: Bearer sk_test_123123123123" \
-d code=AUTHORIZATION_CODE \
-d grant_type=authorization_code

Then I need to parse the JSON response.然后我需要解析 JSON 响应。

Can anyone provide me with a code fragment to get me over this?谁能给我提供一个代码片段来帮助我解决这个问题? Thanks谢谢

我会使用Java OAuth 库来处理代码的 OAuth 部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM