The first step to develop authorization is to create an appropriate form.

Authorization form

For authorization, you will need two input fields:

  1.  Login (here, the login will be an email).
  2.  Password.

Also, you will need a button that will perform authorization BP.

Business Process for authorization

Go to the button Workflow and create a new BP.

First, get the values ​​from the input fields. To do this, use the InputEmail Get Properties and InputPassword Get Properties blocks. Be sure to specify the Component ID so that the BP understands from which fields to take the information.

The next step is to create the authorization itself. Use the Server Request POST /auth block. Pass the value fields from InputEmail Get Properties and InputPassword Get Properties to it.

Now divide the BP into two cases: when authorization was successful and when it failed. Use the If-Else block and pass the _success field from the Server Request POST /auth to it.

On the False output connector (if authorization is unsuccessful), we need to show the user that he was unable to log in. To do this, use the InputEmail Update Properties and InputPassword Update Properties blocks. Also, set the Component ID fields in them, and set the Validate Status to Error. In the Validate Message field, specify Email or password is incorrect.

We need to set the authorization token on the True output connector (if authorization is successful). It requires a Set Auth Token block, to which we will pass the token field from the Server Request POST /auth block.

Now, an authorization token will be added to all API requests of the user.

After installing the token, you can send the user to another page. Use the Navigate block, in which we set the Page field, for example, to the Home page.

Was this article helpful?

AppMaster.io 101 Crash Course

10 modules
2 weeks

Not sure where to start? Get going with our crash course for beginners and explore AppMaster from A to Z.

Start Course
Development it’s so easy with AppMaster!

Need More Help?

Solve any issue with the help of our experts. Save time and focus on building your applications.

headphones

Contact Support

Tell us about your problem, and we’ll find you a solution.

message

Community Chat

Discuss questions with other users in our chat.

Join Community