Replies: 0
Hello,
I was trying to do Oauth but got error {“error”:”invalid_client”,”error_description”:”The required \”client_id\” parameter is missing.”}.
I am giving the same client id which I got while registering on creating app on WordPress developer account.
I am hitting post request and here is my code
def redirect1(request):
url = 'https://public-api.wordpress.com/oauth2/authorize?redirect_uri=http://127.0.0.1:8000/main/redirect' \
'/&response_type=code&blog=1234&client_id=68733'
return redirect(url)
def redirect(request):
code = request.GET['code']
url = 'https://public-api.wordpress.com/oauth2/token'
payload = {
"client_id": "68733",
"redirect_uri": "http://127.0.0.1:8000/main/redirect/",
"client_secret": "pasted which I got from my app",
"code": code,
"grant_type": "authorization_code",
}
header = {"Content-Type": "application/json"}
response = requests.post(url=url, data=json.dumps(payload), headers=header)
return JsonResponse(response.json())
I also tried following-
1. giving client_id as integer
2. header = {“Content-Type”: “application/x-www-form-urlencoded”}
I am following this link