Authorization

1. Prepare Bubble.com

Create a login page on Bubble.com with 2 fields: one for the login and another for the password, along with the Login button.

it may look something like this:

Next, click the Plugin button and add API connector to you project. You plugin page will look like this:

Click on API Connector, then click Add another API.

  1. Set API name to Directual auth

  2. Name it API auth v5

  3. Set use as Action

  4. Set POST address: https://api.directual.com/good/api/v5/auth?appID=XXX, when XXX you API token, which you could find in you project' API section under r API KEYS

  5. Add 3 parameters: provider with the value "rest", username with the value "test", and remove the flag "private"

Now you have an API integration with Directual.com.

Prepare Directual

For testing the integration, open you project and navigate to Database to find the App User structure

Press New object to create the first user

And fill in the ID with value "test" and password with value "test".

After filling the "password" field, please, click to convert to hash, because, since your application doesn't store user passwords; it only stores hash.

The form with data should look like this:

Saving you first user

Creating flow on Bubble for user authorization

Go to the integration on Bubble.com and expand your "Directual auth" integration.

Please, click to "initialization call" to get a result on Directual.com. You will see the following popup:

Click to save, and then remove the default value "test" the from parameters.

Design section

In the Design section, add an alert component. Click the "Login" button, and then click to start/edit the workflow.

Step 1. Validation

Add "Show message in alert box". Fill the message text with: "Please, fill valid login and password". Then add the condition: "Input login's value is empty"

Step 2. Integration with Directual

Add a new step to the workflow.

Step 3. Alert with message

Add an alert message like similar to step 1, providing information that user has been logged in if the token is not empty.

Step 4. Reset login and password after login

Add a step with the category "Element actions" -> "Reset inputs"

Step 5. Save you token for use as session id with request on Bubble pages

Go to the plugin page, and install "session and local storage"

Add "Web Storage" to your page

Go to the flow editor and add a new step:

Set key = sessionID

Set value = result of step2' token

Last updated