【发布时间】:2015-05-26 20:41:55
【问题描述】:
我创建了一个 OAuth 应用程序,它给了我客户端 ID:xxx 客户端密码:yyy Redirect URIs, Authorize URL, Access Token URL 现在我该怎么办?在编码方面,我正在使用 Java。
【问题讨论】:
标签: java authentication oauth coinbase-api
我创建了一个 OAuth 应用程序,它给了我客户端 ID:xxx 客户端密码:yyy Redirect URIs, Authorize URL, Access Token URL 现在我该怎么办?在编码方面,我正在使用 Java。
【问题讨论】:
标签: java authentication oauth coinbase-api
感谢您有兴趣使用我们的 API!
我认为关于如何使用我们的 API 的最佳解释是在我们的 developers site 上的文档中。
看看那个,如果您有任何其他问题,请告诉我们。
该页面特别有用的是您的应用可能会经历的示例流程:
# Redirect the user to this page
https://www.coinbase.com/oauth/authorize?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_CALLBACK_URL&scope=user+balance
# If the user accepts, they will be redirected to:
YOUR_CALLBACK_URL?code=CODE
# Initiate a POST request to get the access token
https://api.coinbase.com/oauth/token&
grant_type=authorization_code&
code=CODE&
redirect_uri=YOUR_CALLBACK_URL&
client_id=CLIENT_ID&
client_secret=CLIENT_SECRET
# Response containing the 'access_token'
{
"access_token": "...",
"refresh_token": "...",
"token_type": "bearer",
"expire_in": 7200,
"scope": "universal"
}
# Now you can use the 'access_token' to initiate authenticated requests
https://api.coinbase.com/v1/account/balance?access_token=...
# Response
{
"amount": "50.00000000",
"currency": "BTC"
}
【讨论】: