我创建了一个OAuth应用程序,它给了我客户端ID:xxx客户端密码:yyy Redirect URIs,Authorize URL,Access Token URL现在该怎么办?在编码方面,我在Java工作。
答案 0 :(得分:1)
感谢您有兴趣使用我们的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"
}