Forum Academy Marketplace Showcase Pricing Features

API - verify username and password

Dear Bubblers,
I am new to bubble.io and I am very impressed by this tool and its vibrant community.
We are working on a project with has to to with the processing of environmental data. The backend uses Postgres as a database and PostgREST (www.postgrest.org) to expose a REST API.
It was very easy to set up the connection between Bubble and our backend system using the standard bubble API Connector.

I have an API function which handles authentication.
The call looks like this:
curl “https://myserver.net/rpc/check_password” -X POST -H “Content-Type: application/json” -d ‘{ “username”: “donaldduck”, “password”: “topsecret” }’
The API answers in case of sucess
{“login”:true,“jwt”:“eyKXbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoidG9kb191c2VyIn0.bsfiSdmAwRvrHG2QcBFPzFr4-11c7fX-iU7IVJcQcK8”}
in case of failure:
{“login”:false,“jwt”:"-"}
I want to set up a simple login-page which asks for username and password and has a “Login” button. After a successful login the user should see another page - in case of wrong username/password the user should see an error message on the login page.

I went through the bubble tutorials and docs and have experience with software and web development and frameworks like Django, but at the moment I dont know how to start here - probably a simple thing for the Bubble - gurus :wink:

Here my questions:

  1. In the Bubble API definition page: apropriate type “Action” or “Data” ?
  2. Bubble API definition page: POST - how to hand over the values for the keys “username” and “password” (from the input fields) ?
  3. What actions should be triggered by the “button is clicked” event to get the login=true/false answer from the api ?
  4. What is the right place to store the JWT string. (The JWT is needed for subsequent API calls) ?

Final remark: using the Bubble -native user-management is no option for that usecase.

Many thanks in advance for your support !
I promise to publish the solution here - as soon I found it out :wink:

Best regards
Wolfgang