Authentication Tutorial
Each Appo can have an authentication mechanism. You can create a web service and check username and password with your database and return some data in JSON Web Token (JWT) payload.
1- To enable authentication in a page just check the ‘Required Login’ checkbox in that page properties tab.
2- Click on ‘Login’ button above the designer window and paste your web service URL. Other fields are optional and you can use them for customization of login form.
3- Let’s create a fake login service. Go to ‘Services’, use the login template and create a service. Click on fake data.
4- In ‘Structure’ section keep inputs and don’t change them. In JWT tab you can add JSON fields. Add profileId .These fields are return back to user after logging in.
5- In ‘Fake Data’ click ‘New Fake Data’ button, in ‘Inputs’ define username and password, In ‘Results’ define JWT field’s data and finally click ‘Add’ button.
Enter fake username and password
Enter fake fields of JWT
6- You can use this web service in Login settings and use the result data with this code: @{login.profileId} profileId is the field name of JWT. You can also use @{login.loggedin} to check if the user is authenticated or not.
7- After Logging In, All requests to your sever contains a JWT in header, This JWT is the one you have sent to user after successful authentication.The JWT contains the simple JSON object.
Login variables are available in Variable Generator
Copy link