Start a new topic
Answered

Get api_key for device returns 401

Hi,

I try using the new v2 api to get the api_key for local access.

I am able to get an access token via oauth:

 

{
  "access_token": "xyz",
  "expires_in": 7200,
  "token_type": "Bearer",
  "scope": "basic devices_read devices_write",
  "refresh_token": "123"
}

 in a next step I try to call the v2 api me devices with the provided token, but response is always "unauthorized". Request looks like this in fiddler:

  

GET https://developer.lametric.com/api/v2/users/me/devices HTTP/1.1
Accept: application/json
X-Access-Token: xyz
Cache-Control: no-cache
Host: developer.lametric.com
Cookie: session=s308elpcpqac718ldhue5birk4 

 Regards

Bernd 


Best Answer

Hi Bernd,


Looks like the issue is in authorization header. For API v2 you should use "Authorization: Bearer xyz" header. We will update the documentation. Hope it helps. 


Best regards,

LaMetric Technical Support


Hi Team,

thanks. It works when using "Authentication: Bearer xyz"


Regards

Bernd

Answer

Hi Bernd,


Looks like the issue is in authorization header. For API v2 you should use "Authorization: Bearer xyz" header. We will update the documentation. Hope it helps. 


Best regards,

LaMetric Technical Support

Login or Signup to post a comment