gpt4 book ai didi

ios - 通过 Coinbase iOS SDK 检索所有用户钱包

转载 作者:可可西里 更新时间:2023-11-01 03:33:23 24 4
gpt4 key购买 nike

我最近一直在尝试使用 Coinbase iOS SDK,但在检索用户的以太坊、莱特币和比特币现金余额以及历史交易时遇到了问题。目前,我只能用比特币、美元和欧元做到这一点,这似乎与 Coinbase 提供的演示应用程序的行为一致。

我已经使用 OAuth2 在 Coinbase API 访问页面上配置了一个应用程序,生成的客户端 ID 和密码正在该应用程序中使用。

问题似乎源于我修改了 Coinbase iOS SDK 以允许我将帐户参数传递为'全部'。我曾希望这能让我查看所有用户账户(ETH、BTC、LTC 等)的详细信息,但是,在 Coinbase 对象上调用“getAccountsList”时我只能获得 BTC、美元和欧元。

NSString *accessToken = [response objectForKey:@"access_token"];
Coinbase *client = [Coinbase coinbaseWithOAuthAccessToken:accessToken];

[client getAccountsList:^(NSArray *accounts, CoinbasePagingHelper *paging, NSError *error) {
for (CoinbaseAccount *account in accounts) {
// Only BTC, USD and EUR are in the accounts array at this point.
}
}];

这令人惊讶,因为权限请求页面正确地向用户询问了所有钱包,如下面的屏幕截图所示:

enter image description here

我怀疑解决此问题的方法是使用 API key ,因为您可以准确指定要授予访问权限的帐户。不过,我打算分发该应用程序,因此不应使用此技术。

enter image description here

这是我发送的 URL 示例:

https://www.coinbase.com/oauth/authorize?response_type=code&client_id=CLIENT_ID_GOES_HERE&account=all&scope=balance%20transactions%20user&redirect_uri=com.example-name.example-app.coinbase-oauth%3A%2F%2Fcoinbase-oauth

有谁知道我如何使用 OAuth 请求访问所有用户帐户并能够检索每个帐户的详细信息?我定义的范围是否以某种方式不正确?我能想到的唯一选择是逐一请求访问每个钱包并存储单独的访问 token 。但是,这不会是很好的用户体验。

谢谢!

最佳答案

添加参数

account=all

到 oAuth 端点:https://coinbase.com/oauth/authorize ?account=all&response_type=code.‌ ..

详情如下:https://developers.coinbase.com/docs/wallet/coinbase-connect/permissions

Coinbase Connect applications can request different access to user’s wallets. This access is defined by account parameter on OAuth2 authorization URL. Available options are:`

  • select - (default) Allow user to pick the wallet associated with the application
  • new - Application will create a new wallet (named after the application)
  • all - Application will get access to all of user’s wallets

关于ios - 通过 Coinbase iOS SDK 检索所有用户钱包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48123361/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com