doutao4480 2018-12-23 04:43
浏览 640
已采纳

oauth令牌请求错误,“缺少必需的参数'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: https://gist.github.com/yshuman1/2b496e0fe698a5a0df087c60f4583677

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" }

  • 写回答

1条回答 默认 最新

  • dongyi9023 2019-01-04 07:40
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?