goanda icon indicating copy to clipboard operation
goanda copied to clipboard

Authorization issue

Open mg64ve opened this issue 5 years ago • 1 comments

Hi, after I changed the code to:

package main

import (
	"log"
	"os"

	"github.com/awoldes/goanda"
	"github.com/davecgh/go-spew/spew"
	"github.com/joho/godotenv"
)

func main() {
	err := godotenv.Load()
	if err != nil {
		log.Fatal("Error loading .env file")
	}
	key := os.Getenv("OANDA_API_KEY")
	accountID := os.Getenv("OANDA_ACCOUNT_ID")
	oanda := goanda.NewConnection(accountID, key, false)
	history := oanda.GetCandles("EUR_USD", "10", "1M")
	spew.Dump(history)
}

I am getting the following error:

2018/10/23 13:46:22 /root/go_projects/src/github.com/awoldes/goanda/utils.go:22: 
OANDA API Error: {"errorMessage":"Insufficient authorization to perform request."}
On route: /instruments/EUR_USD/candles?count=10&granularity=1M

Account is good, I have tried with curl and it works.

mg64ve avatar Oct 23 '18 11:10 mg64ve