我一直在使用 https://opensource.indeedeng.io/api-documentation/docs/campaigns/auth/ 的 Indeed 文档来创建活动。
curl -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json" \
"https://secure.indeed.com/oauth/tokens?code=MY_SECRET_CODE&client_id=MY_CLIENT_ID&client_secret=MY_CLIENT_SECRET&redirect_uri=MY_REDIRECT_URI&grant_type=authorization_code"
它返回:
{"error_description":"Invalid grant","error":"invalid_grant"}
我尝试联系 Indeed,但没有人回复我。
有什么解决办法吗?
答案 0 :(得分:0)
一个原因可能是您在 Indeed 应用中配置的 重定向 URL 与您对授权代码的请求不匹配。
示例:
在您配置的应用程序/API 密钥中 https://myapp.test.com/oauth
(勾选https://secure.indeed.com/account/apikeys)
在 OAuth 请求 url 中,您的重定向 url 略有不同:
https://secure.indeed.com/account/oauth?client_id= MY_CLIENT_ID&redirect_uri=http%3A%2F%2Fwww.somethingElse.com%2Foauth&response_type=code
匹配它们完全解决了我的问题,而且效果很好。