ETrade API authentication could not be completed at this time

I have been trying to get authorized on the ETrade API for a month now using Golang. I have been in contact with their technical support but they are useless. It takes a week for them to respond and sometimes the response is that they are sorry it is taking so long. The latest response just listed the api URLs again.
I have been using these libraries:

github.com/blbgo/etradeapi
github.com/dghubble/oauth1 

They use Oauth1, so step one is to request a temporary token. Then you use that token to request the next token using a redirect. A couple of times, their website asked for my credentials to allow the app to access my account, but usually it goes right to the error message.
Here is my code:


func GetOauthToken(p *data.DaemonPage, w http.ResponseWriter, req *http.Request) error {
	endpoint := oauth1.Endpoint{
		RequestTokenURL: REQUEST_TOKEN_URL,
		AuthorizeURL:    AUTHORIZE_URL,
		AccessTokenURL:  ACCESS_TOKEN_URL,
	}
	config := oauth1.Config{
		ConsumerKey:    SANDBOX_API_KEY,
		ConsumerSecret: SANDBOX_API_SECRET,
		CallbackURL:    "oob",
		Endpoint:       endpoint,
	}

	var err, err1 error
	requestToken, requestSecret, err = config.RequestToken()
	if err != nil {
		return err
	}
	fmt.Println(requestToken, requestSecret)

	authorizationURL, err1 := config.AuthorizationURL(requestToken)
	if err1 != nil {
		return err
	}

	values := authorizationURL.Query()
	fmt.Println(values)

	http.Redirect(w, req, authorizationURL.String(), http.StatusFound)

	return nil
}

When I do the redirect, I get this message:

Due to a logon delay or other issue, your authentication could not be completed at this time. Please try again.

If anyone can offer suggestions, I would greatly appreciate it.

Hi, Rick, as a disclaimer, I know nothing about OAuth1 or 2 and next to nothing about HTTP, but I’d like to try to help.

Is there a way to dump the entire HTTP request from Postman, where I think you’ve said that this works (headers and the body? I don’t know if HTTP has trailers, but those too, if it has them)? If so, I would recommend copying the definition of the (*github.com/dghubble/oauth1.Config).RequestToken method (or the AuthorizationURL method, depending on which one is producing that error you included) out into its own function in your package and add a call (or calls) to net/http/httputil.DumpRequestOut to write the message out to a file so that you can open both Postman’s version of the request(s) and use a diff tool to compare them side-by-side. Maybe that will help identify what (if anything) Postman is doing that Go isn’t, or perhaps something Go is doing that it shouldn’t be?

Actually, it doesn’t work in Postman, either. I tried specifying a callback, which they recommend, but I still get the same error message.
I even tried downloading their Java project for accessing etrade, but it just errors out. It doesn’t even get as far as mine.