我正在尝试使用PHP Coinbase API。我已经有一个API密钥和OAuth密钥。我已经设置了Web服务器。另外,我已经在GitHub上下载了该库,但是仍然无法正常工作。
每次我使用此代码时,它都会返回:
string(213)“ {” error“:” invalid_grant“,” error_description“:” The 提供的授权授权无效,已过期,已被撤销,未 匹配授权请求中使用的重定向URI,或者为 发行给另一个客户。“}”
相关代码
docker ps
答案 0 :(得分:0)
您应该做的第一件事是转到auth端点并获取auth代码,然后将其发送回并获得访问令牌作为响应。
通常,请求应如下所示:
response_type
REQUIRED. Value MUST be set to "code".
client_id
REQUIRED. The client identifier as described in Section 2.2.
redirect_uri
OPTIONAL. As described in Section 3.1.2.
scope
OPTIONAL. The scope of the access request as described by
Section 3.3.
state
RECOMMENDED. An opaque value used by the client to maintain
state between the request and callback. The authorization
server includes this value when redirecting the user-agent back
to the client. The parameter SHOULD be used for preventing
cross-site request forgery as described in Section 10.12.
您可以在这里看到https://tools.ietf.org/html/rfc6749#section-4.1.1
实际上在Coinbase文档https://developers.coinbase.com/docs/wallet/coinbase-connect/integrating
中您已跳过该步骤,并且尝试从coinbase文档的第3步开始!
还要确保在coinbase上也正确配置了客户端。并且重定向网址完全匹配。