Hi all
I've set up an application on dev.netatmo.com and have retrieved the client_id and client_secret. However, when trying to get hold of the access_token using the client credentials option in Oauth2, I keep getting "400 Bad request" error. I have tried sending this through Postman, but no luck.
The following URL is posted from Postman:
https://api.netatmo.com/oauth2/token?gr ... &username=[email@email.no]&password=[MY_PASSWORD]&scope=read_station
I've doubled and triple checked that my CLIENT_ID, CLIENT_SECRET, username and password is correct. I have even tried resetting the CLIENT_SECRET, but without any luck.
The response is:
{
"error": "invalid_request",
"error_description": "Invalid grant_type parameter or parameter missing"
}
The app in dev.netatmo was created just yesterday, and is set up according to requirements. I have made sure that it is activated.
Any tips or hints on what could be wrong here?
Thanks.
Oauth2 client credentials keep failing
Re: Oauth2 client credentials keep failing
Hello,
For your first /authorize request, you put infos as URL parameters
For your /token request, needed infos must be set in the Body
It should resolve your issue
Have a good day,
Leslie - Community Manager
For your first /authorize request, you put infos as URL parameters
For your /token request, needed infos must be set in the Body
It should resolve your issue
Have a good day,
Leslie - Community Manager
Re: Oauth2 client credentials keep failing
Hi @LordTWO
Did you get this to work? I am having the same problem.
Did you get this to work? I am having the same problem.
-
- Posts: 1
- Joined: 16 Sep 2021, 10:55
Re: Oauth2 client credentials keep failing
Hi!
Had the same problem.
Got it to work with Postman and C# when putting all commands in Body (as suggested).
Example:
(*) Replace xxx with your settings
Had the same problem.
Got it to work with Postman and C# when putting all commands in Body (as suggested).
Example:
Code: Select all
var client = new RestClient("https://api.netatmo.com/oauth2/token");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer xxx");
request.AlwaysMultipartFormData = true;
request.AddParameter("client_id", "xxx");
request.AddParameter("client_secret", "xxx");
request.AddParameter("grant_type", "password");
request.AddParameter("username", "xxx");
request.AddParameter("password", "xxx!");
request.AddParameter("scope", "read_station");
IRestResponse response = client.Execute(request);
var rx = response.Content;