Retrieving All User Wallets Using the Coinbase iOS SDK

I recently experimented with the Coinbase iOS SDK, and I had problems getting custom Ethereum, Litecoin and Bitcoin Cash balances and historical transactions. Currently, I have only managed to do this with Bitcoin, USD and EUR, which seems to be consistent with the behavior of the demo application provided by Coinbase.

I configured the application on the Coinbase API access page using OAuth2, and the generated client ID and secret code are used in the application.

The problem seems to be due to the fact that I modified the Coinbase iOS SDK to allow me to pass the account parameter as' everything. This, I was hoping, would allow me to view the details of all user accounts (ETH, BTC, LTC, etc.), however I only get BTC, USD and EUR when calling getAccountsList on the Coinbase object.

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. 
    }
}];

This is surprising since the permission request page correctly requests all wallets from the user, as you can see in the screenshot below:

enter image description here

I suspect a solution to this would be to use API keys, as you can specify exactly which accounts to grant access to. However, I plan to distribute the application, so this method should not be used.

enter image description here

Here is an example of the url I am submitting:

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, ? ? , , - . .

!

+6
4

, SDK iOS . - API.

Coinbase SDK. . , wallet:accounts:read, ["accounts": "all"] - startAuthentication.

. getAccountList, .doGet api v2 ( coinbase.doGet("https://api.coinbase.com/v2/accounts", parameters: nil) {(response, error) -> Void in

. json .

0

account=all

oAuth: https://coinbase.com/oauth/authorize? account = al l & response_type = code...

: https://developers.coinbase.com/docs/wallet/coinbase-connect/permissions

Coinbase Connect . URL OAuth2. : `

  • - ( ) ,
  • new - ( )
  • -
+2

, , Coinbase

, , Coinbase digital api, , , , API ( - )

Coinbase:

API- . Coinbase, API-. Coinbase, Coinbase Connect (OAuth2)

:


  • API USE

, wallet:accounts:read API ( ) .

iOS - coinbase CocoaPods - ::

pod "coinbase-official"

  • OAuth2

this,

, API-, . OAuth2 -, .

coinbase-connect , - OAuth2.

, OAuth2, .

, scope ( () ), , , .

, API: wallet:accounts:read, :

GET https://www.coinbase.com/oauth/authorize?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URL&state=SECURE_RANDOM&scope=wallet:accounts:read

():

{
"access_token": "6915ab99857fec1e6f2f6c078583756d0c09d7207750baea28dfbc3d4b0f2cb80",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "73a3431906de603504c1e8437709b0f47d07bed11981fe61b522278a81a9232b7",
"scope": "wallet:user:read wallet:accounts:read"

}

, API, , :

Authorization: Bearer 6915ab99857fec1e6f2f6c078583756d0c09d7207750baea28dfbc3d4b0f2cb80

, API, API .


, , :

, , , , .

0

- .

param account=all. ( , op). BTC Wallet, BTC Vault, EUR Wallet BTC Wallet. param account=new.

param account_currency=BTC,ETH ETH Wallet oAuth. getAccountsList, 0 .

API Coinbase (- > ).

: balance transactions user

: .../oauth/authorize?account=all&response_type=code&client_id=%...

0

All Articles