Authenticate via API and user input


This is my case:

I have a login page where the users enter their email and password.

When they click on the Login button, I want to pass the input values as parameters in the Body of an API request. The response will be a Bearer access token.

After that, I want to redirect the user to a dashboard page where every button/action do other requests by using the access token.

What steps should I follow to achieve this?

I haven’t found a solution so far online.

You you are trying to generate a access token for your bubble user right.

For this,

  • Create a backend API workflow with two parameter , email & password.
  • Then inside that parameter just login the user. ( Dont need to return any thing)
  • when you call this end-point form API connector, by passing the email into email parameter and password into password parameter. it will return you an access token which is the representationg of that user.

The access token you get, you can use to call other API workflow, which need authentication.

also, Its good idea to generate and API token form editor for this API call which you make to get access token.

And if you not getting the access token when you make the call, then try to return data, by selecting the result of login call.

I hope this will help, Sorry if i am missing somethign.

Hi Baloshi,

First of all thank you very much for your help.

As I am new to Bubble, I am missing some basic understanding of how the backend workflows work.

So far, I have created a backend workflow:

Then, I created an action to log the user in:

Then, in the login page, I added an action to the login button to schedule the API Workflow:

I am sure that I am missing something.

I still don’t understand how can I receive and save the access token. Basically, I want to redirect the users to another page after they log in, and in that page use the received access token to make another call.

Hopefully I am clear to what I want to achieve :slight_smile:

Yeah, you are missing few things

as the workflow needs a token, you need to generate it from the editor ( in general => API => then you can see a button that says ** Generate a new API TOKEN** Click it and it will generate a token you need to call this API workflow as it needs authentication ( which is a good thing ).

once you get the token, you need to build an API Call inside the API connector, you are currently calling it with Schedule API Workflow you need to call it with API Connector call.

You need to initialize the call for the first time, to be able to use it later, and then use the created API call to trigger it from frontend and use the result of the call to get an access token for that user, you can use this token to call the other API workflow same way by using the access token, when you call the other API workflow you are calling it as the user who’s token is being used…

I hope this solves your issue, else we can discuss a time, and I will help you create it.

Hello Baloshi,

First of all, thank you for your eagerness to help.

Is it sure that I need to generate an api token from within under General => API => Generate a new API TOKEN?

Because, my endpoint is “https://<PROJECT_KEY>”

The headers are:

apikey: API_KEY
Content-type: application/json

The Body (JSON) contains:


And, the result (response) is the access token of the user with USER_EMAIL.

Something like:

“access_token”: “exgoijlkqjoajlkasjfolka…”
“token_type”: “bearer”,
“expires_in”: 3600,


So, when the user logs in (at the login page), I need to use their email and password (inputs from the login form of the login page) as parameters to get the access token from my endpoint and use it in other pages of the app.

Is this possible with