Authorization
Last updated
Last updated
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.
Set API name to Directual auth
Name it API auth v5
Set use as Action
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
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.
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
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.
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"
Add a new step to the workflow.
Add an alert message like similar to step 1, providing information that user has been logged in if the token is not empty.
Add a step with the category "Element actions" -> "Reset inputs"
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