Error 403 - The request is blocked
I am calling the token API to get a token within my app. I have entered the required credentials and confirmed and re-confirmed them, however still get an error that blocks my request. Can anybody help?
The code I use for the call:
headers = {"User-Agent": "Mozilla/5.0","Content-Type": "application/x-www-form-urlencoded"}payload = {"grant_type": "password","client_id": NETATMO_CLIENT_ID,"client_secret": NETATMO_CLIENT_SECRET,"username": NETATMO_USERNAME,"password": NETATMO_PASSWORD,"scope": NETATMO_SCOPE}response = requests.post("https://api.netatmo.com/oauth2/token", data=payload, headers=headers)
Status: 403
Content: <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'><head>
<meta content='text/html; charset=utf-8' http-equiv='content-type' />
<style type='text/css'>
body {
font-family: Arial;
margin-left: 40px;
}img {
border: 0 none;
}#content {
margin-left: auto;
margin-right: auto
}#message h1 {
font-size: 24px;
font-weight: normal;
color: #000000;
margin: 34px 0px 0px 0px
}#message h2 {
font-size: 20px;
font-weight: normal;
color: #000000;
margin: 34px 0px 0px 0px
}#message p {
font-size: 16px;
color: #000000;
margin: 8px 0px 0px 0px
}#message hr {
margin: 15px 0px
}#errorref {
font-size: 11px;
color: #737373;
margin-top: 41px
}
</style>
<title>Service unavailable</title>
</head><body>
<div id='content'>
<div id='message'>
<h2>The request is blocked.</h2>
</div>
<div id='errorref'>
<span>ERROR CODE BLURB </span>
</div>
</div>
</body>
</html>
Wehre ERROR CODE BLURB in the response seems to be an error code for the request.
Commentaires
1 commentaire
Hello,
Sorry for the long delay in my answer
The client_credentials authentication type is not possible anymore for 2 years now. You must use the authentication_code grant type (documentation available here : https://dev.netatmo.com/apidocumentation/oauth#authorization-code)
Have a good day,
Leslie - Community Manager
Vous devez vous connecter pour laisser un commentaire.