[Solved] Authentications of the REST API


#1

I am using Losant for a school project. Losant is responsible for receiving al the IoT devices, saving it, and converting it to orderd data. When the data is correct its send to a front-end. Here I want to use Bubble.is for. Bubble.is has a Plugin called API connector. here i can define API calls to get the data. I want to configure the API connector so that it can get all the data from a specific application OR workflow.

What is te correct way to handle the calls. do i need to authorize a user? this works with an application like Postman but not with the API.connector. but aftere that I reckoned that i need to get an API token for the application because i cant ask for a new token every time because (i think) bubble does not support this.

i have read all the documentation of the REST API but i cant figure it out. Thats why i ask this on the forum. i hope someone can help me

Kind regards,

Kristiaan


#2

I haven’t used Bubble before, but looking at the documentation for the API Connector, you should be able to build a connection to the Losant API.

First, you’ll want to generate an application API token in your Losant application. This will allow you to make authenticated data calls against the Losant API. I recommend setting “Token Expiration Date” as “Never Expires”, and setting “Token Permissions” as “Read only”. After you create the token, make sure to copy it to a safe place or download it as you’ll need it later when configuring authentication within Bubble.

Then, in Bubble, you can set up the API connector to make calls to the Losant data API endpoints. If you need help configuring the call to retrieve the data you need, I can assist with that if you can provide a little more information about what you’re looking to retrieve in Bubble.

For your authentication method when setting up the connection in Bubble, you’ll want to use “Private key in header”. The header name is “Authorization” and the value is “Bearer YOUR_TOKEN” where YOUR_TOKEN is the API token you generated in your application.

Let me know if this is what you’re looking for!


#3

hello Dylan,

thanks for your reaction! I have enough info to continue with my project for now… If I have more questions I know where to find you!