com.coinbase.api.exc­eption.UnauthorizedE­xception

0 votes

I'm making a web application using Coinbase API. API link: https://github.com/coinbase/coinbase-java

Now i'm trying to run a simple program but i'm getting error as:

com.coinbase.api.exc­eption.UnauthorizedE­xception:
  at com.coinbase.api.Coi­nbaseImpl.doHttp(Coi­nbaseImpl.java:1191)
  at com.coinbase.api.Coi­nbaseImpl.get(Coinba­seImpl.java:1214)
  at com.coinbase.api.Coi­nbaseImpl.getUser(Co­inbaseImpl.java:142)
  at Main.main(Main.java12)

Here is my Program:

import com.coinbase.api.Coi­nbase;
import com.coinbase.api.Coi­nbaseBuilder;

public class Main {
     public static void main(String[] args){

     try {
        Coinbase cb=new CoinbaseBuilder()
        .withApiKey(System.g­etenv("My API KEY"), System.getenv("MY API SECRET"))
        .build();

        cb.getUser().getEmai­l();

     } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
Sep 5, 2018 in Blockchain by slayer
• 29,170 points
62 views

1 answer to this question.

0 votes

Start by creating a new OAuth 2.0 application

// Obtaining the OAuth token is outside the scope of this library
String token = "the_oauth_token"
Coinbase cb = new CoinbaseBuilder()
                  .withAccessToken(token)
                  .build();

Now you can call methods on coinbase similar to the ones described in the api reference. For example:

cb.getUser().getEmail(); // user@example.com
answered Sep 5, 2018 by digger
• 26,550 points

Related Questions In Blockchain

0 votes
1 answer

How to Track Payment API in Coinbase

Use the callback_url option as described in the API. READ MORE

answered Sep 5, 2018 in Blockchain by slayer
• 29,170 points
42 views
0 votes
1 answer

How to use Coinbase send_money API?

<?php require_once(dirname(__FILE__) . '/../lib/Coinbase.php'); // Create an application at ...READ MORE

answered Sep 12, 2018 in Blockchain by slayer
• 29,170 points
93 views
0 votes
2 answers

how to integrate coinbase api in php for transfer bitcoine

Here the code for php please have ...READ MORE

answered Sep 17, 2018 in Blockchain by Suresh
254 views
0 votes
1 answer

Historical ethereum prices - Coinbase API

def get_spot_price(self, **params): """https://developers.coinbase.com/api/v2#get-historic-prices""" ...READ MORE

answered Sep 21, 2018 in Blockchain by digger
• 26,550 points
223 views
0 votes
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by ariaholic
• 7,340 points
83 views
0 votes
1 answer

Required parameter missing: account error

You need to swap out the place ...READ MORE

answered Aug 30, 2018 in Blockchain by slayer
• 29,170 points
54 views
0 votes
1 answer

How to get property of non object in Coinbase API

First, your sendMoney() call is stored into ...READ MORE

answered Aug 31, 2018 in Blockchain by digger
• 26,550 points
38 views
0 votes
1 answer

Coinbase API: Get transaction fees

The Coinbase "fee" is the difference between ...READ MORE

answered Aug 23, 2018 in Blockchain by digger
• 26,550 points
133 views
0 votes
1 answer

403 forbidden error coinbase api

I had a similiar issue connecting this API, ...READ MORE

answered Aug 28, 2018 in Blockchain by digger
• 26,550 points
447 views