Regarding implementation of OAuth2

The following curl call (with the correct parameters passed):

curl -X POST http://api.codechef.com/oauth/token -H 'content-Type: application/json' -d '{"grant_type": "authorization_code","code": "<auth_code>","client_id":"<client_id>","client_secret":"<client_secret>","redirect_uri":"http://127.0.0.1:8000/success"}'

produces the following output:

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.4.7</center>
</body>
</html>

Can someone help me regarding this?

This is the response I am getting when making a corresponding POST request from my back-end code:

{'status': 'error', 'result': {'errors': {'message': 'Not Allowed'}}}

Can anyone point out the mistake that I am making here?

Thanks!

Hi,
Use https://api.codechef.com/oauth/token instead of http://api.codechef.com/oauth/token

1 Like