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,370 points
1,021 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,740 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,370 points
812 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,370 points
1,871 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
3,135 views
0 votes
1 answer

Historical ethereum prices - Coinbase API

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

answered Sep 21, 2018 in Blockchain by digger
• 26,740 points
1,852 views
+1 vote
1 answer

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

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,426 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,370 points
1,540 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,740 points
753 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,922 views
+1 vote
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,740 points
1,738 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,740 points
2,638 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP