【问题标题】:How to authenticate in coinbase with OAuth如何使用 OAuth 在 coinbase 中进行身份验证
【发布时间】:2015-05-26 20:41:55
【问题描述】:

我创建了一个 OAuth 应用程序,它给了我客户端 ID:xxx 客户端密码:yyy Redirect URIs, Authorize URL, Access Token URL 现在我该怎么办?在编码方面,我正在使用 Java。

【问题讨论】:

    标签: java authentication oauth coinbase-api


    【解决方案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"
    }
    

    【讨论】:

    • 您好约翰,感谢您的回复。我不想在请求后表单中,我想使用 java 函数,所以需要知道调用身份验证的函数。而在获取令牌时,参数代码是什么?我应该在那里提什么。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-10-20
    • 2014-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-04
    相关资源
    最近更新 更多