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.exception.UnauthorizedException:
at com.coinbase.api.CoinbaseImpl.doHttp(CoinbaseImpl.java:1191)
at com.coinbase.api.CoinbaseImpl.get(CoinbaseImpl.java:1214)
at com.coinbase.api.CoinbaseImpl.getUser(CoinbaseImpl.java:142)
at Main.main(Main.java:12)
Here is my Program:
import com.coinbase.api.Coinbase;
import com.coinbase.api.CoinbaseBuilder;
public class Main {
public static void main(String[] args){
try {
Coinbase cb=new CoinbaseBuilder()
.withApiKey(System.getenv("My API KEY"), System.getenv("MY API SECRET"))
.build();
cb.getUser().getEmail();
} catch (Exception e) {
e.printStackTrace();
}
}
}