oauth token request errors with "missing required parameter 'client_id'",


I’m trying to get a token from squares oauth. I can successfuly get the code but when i try to get the token i receive the error “missing required parameter ‘client_id'”.

I can successfully get a token from postman but not sure why oauth2.Exchange is not passing all info to the oauth server when I try to do it programmatically.

here is a gist of my oauth2.Config object: https://gist.github.com/yshuman1/dedaead8568e695df7a06f86cd986c2d

here is a gist of my failing callback function:

Here is a gist of the redirect & callback functions as well as the oauth2.Config object: https://gist.github.com/yshuman1/b3c472978a4b1b73d6668dfe583f440f

In the callback gist, i also attempted passing in context.TODO() instead of context.Background().

any advice would be appreciated!

I’ve tried passing the missing items in but not sure what to do to get it done correctly.

I expect to receive a oath token back but dont. I’m getting the error

"message": "missing required parameter 'client_id'",
"type": "bad_request.missing_parameter"


i ended up solving this by replacing the .Exchange method used to obtain a token with a simple http.POST request to obtain it.

Answered By – Yasin Shuman

Answer Checked By – Jay B. (GoLangFix Admin)

Leave a Reply

Your email address will not be published.