Most of my customers use a WebApp to access their data, but some are more sophisticated and would like to use the client REST API. A customer may have multiple devices assigned to him or her.
That in mind:
How would a customer obtain the DEVICE_PUBLIC_KEYs for each of his/her devices?
If a customer needs to call mdash.net/api/v2/customer, how would he/she obtain his/her CUSTOMER_KEY?
To clarify, as the owner/admin I know how to get this info from the mDash dashboard, but not clear how a customer would obtain this information on their own.
There, a customer enters email + password, clicks on login button, and JS code sends a /customer GET request with the basic authorisation header. A response is a customer JSON object with token and list of customer’s devices (their PUBLIC_KEYs).
Thanks for these details - it’s clear how one obtains the device PUBLIC_KEYs now.
I am confused, however, regarding the usage of /customer GET endpoint. In the Client API doc it states:
Every request must have a ?access_token=CUSTOMER_KEY query string attached, or a Authorization: Bearer CUSTOMER_KEY header specified.
…but you mention above that username/password authorization should be used with this GET call instead of the CUSTOMER_KEY token approach in the docs. Do both methods apply?
A customer must know its email + pass.
Make a Basic auth request using email + pass, and get a customer JSON object back. A JSON object contains CUSTOMER_KEY.