Learn how to create a mobile app in Unifinity that works with kintone.
The REST API mechanism provided by Kintone is used for the linkage.
In this article, we will introduce the user authentication (password authentication) method required to use kintone's REST API.
The sample project used in the explanation can be downloaded from the following link. We hope you will take advantage of it.
kintone: user authentication application
Overview of the application to be created
Have users enter the information required to use kintone's REST API,
The information is converted into a format for user authentication,
The information is stored in a DB (database) so that users do not have to enter the information repeatedly.
Create an application.
Setting up kintone
If you subscribe to the Standard Course, there is no need to configure the kintone side.
Please refer to the following for details on the user authentication mechanism provided by kintone.
https://kintone.dev/en/docs/common/authentication/
Unifinity collaboration settings
1. screen creation
First, we will create a screen to enter the necessary items for kintone user authentication.
For basic Unifinity operation, click here.Tutorial Videosfor more information.
(1) Place a text box on the screen for entering the kintone login name and password.
This time, placeholders are set for each text box to guide the user.
For text boxes that require a password to be entered, checking the password checkbox in the object's behavior settings tab will hide the entered password.
(2) Install a button to convert the entered information into a user authentication format.
In this case, the button is labeled "login" to guide users.
Screen creation is now complete (there are areas to be updated after creating the process in section 3.)
2. creation of DB
Create a DB in Unifinity to store the entered login name, password, and user authentication information.
(1) Create a DB for storing login names and passwords.
After creating the data file, please enter an easy-to-understand name for the item name and physical item name.
(2) Create a DB for storing user authentication information.
This is also the same as (1). Only one item need be prepared.
DB creation is now complete.
3. process creation
Create the action when the button created on the screen is pressed.
For each item, we will explain the process one by one.
(1) The entered login name and password are stored in the DB.
#2,#3 | ."Control/Content Acquisitionto select the contents to be stored in the DB. This time, select the items to enter the "Login Name" and "Password" on the "User Authentication" screen created in step 1. |
#4 | ."Database/DeleteClear the data that has been stored so far using the "Clear" function. (If this process is not performed, the entered login names and passwords will be accumulated.) |
#5 | ."Database/AdditionAdd the contents selected in #2 and #3 to the relevant items in the DB created in #2.1. |
The above process stores the login name and password in the DB.
(2) Convert the input contents into a user authentication format.
The kintone user authentication format is "add 'X-Cybozu-Authorization' to the request header and BASE64-encode the 'login name:password'", so we will convert it to that format.
#7,#8 | ."Database/Retrievalto read the "login name" and "password" stored in the DB. |
#9 | ."String Functions/Concatenationto generate the string "login name:password". |
#10 | ."String Functions/Base64 Encodingto convert the string generated by #9 to Base64 format. |
#11 | ."String Functions/Concatenationand concatenate "X-Cybozu-Authorization:" before #10. |
The resulting data is as follows and the conversion is complete.
// If your login name is "Administrator" and your password is "cybozu X-Cybozu-Authorization:QWRtaW5pc3RyYXRvcjpjeWJvenU=
(3) Data converted into the user authentication format is stored in the DB.
#13 | ."Database/DeleteClear the data that has been stored so far using the "Clear" function. (Without this process, the entered user authentication data will accumulate.) |
#14 | ."Database/AdditionAdd the contents generated in #11 to the relevant items in the DB created in #2. |
The above process stores user authentication information in the DB.
4. stringing
Once this is done, all that remains is to link the screen to the DB and processing.
(1) Link the screen to the DB. (Optional)
If the user does not need to enter the login ID and password after the first entry, this can be achieved by linking the DB value to the text box.
Specifically, after selecting the text box for the login name, select Table on the Contents tab, and then select the DB table and field names created in 2.(1) (the same applies to passwords).
This will automatically populate the box for the login name if data is stored in the DB.
(2) Link the screen to the process.
Select the process to be executed when the button is pressed.
Specifically, after selecting the button you want to execute the process, select the process created in 3. from the Execution Process in the Behavior Setting tab.
The application is now complete.
Run the application, enter the login name "Administrator" and password "cybozu", and click the login button.
In the next issue, we will actuallyHow to create an application to register kintone recordsto the following.
The sample projects used in the explanation can be downloaded from the following links.