Here is an example how to poll data from your Gateway:
e.g.
curl -H “Authorization: Bearer 0i0XJhGjpiMdEBRxI+hEXtJoGoL1jM7DFv6c6netsjU=” http://192.168.1.108/history
after setting up the Bearer authentication.
If you want to get data from Ruuvi Cloud, you can use our API:
Please note that our API is in beta and while we use it internally and don’t plan to do any big changes, some breaking changes are to be expected especially before we have launched the Ultimate subscription plan.
From /verify you get the actually access token you can use to authenticate to Ruuvi Cloud. Please be careful while developing, we may throttle or ban IPs and accounts which cause exceptional amount of traffic for example by downloading full history data of a tag repeatedly as that resembles a DOS attack to our service.
Thanx!
I found the API alright, just not an automated flow for retrieving the token. Reading mail can of course be done by servers but it quite cumbersome compared to normal OAuth-processes.
What is the lifespan of the token returned from this?
I saw that this is the same flow that You use in your web-frontend.
Of course I will cache the data. In my simple use case I want to display the last few hours temperature in the Sauna to be able to determine if the sauna is on or off.
What would be your preference for system-to-system login? My first instinct would be to accept a key certificate you have created and then allow requests with that certificate to generate new access tokens for specific account, but I’d love to hear thoughts on what would serve your use case
For my use case, our preference would be to use a standard OAuth 2.0 Client Credentials flow for system-to-system authentication.
Ideally, we would receive a client_id and either a client_secret or certificate/private key setup, and then use that to request access tokens for a specific account or scope.
Your suggestion of using a client certificate to generate access tokens sounds very reasonable and aligns well with modern machine-to-machine authentication patterns. If possible, we would prefer it to follow a standard OAuth 2.0 approach rather than a custom implementation, since that makes the integration simpler, more maintainable, and easier to support long term.
In summary, our preferred setup would be:
OAuth 2.0 Client Credentials flow
Authentication using either:
client_id + client_secret, or preferably
certificate/private key based authentication
That would work very well for our integration needs.