Auth module provides authentication and authorization for your application, including user management, group management, user registration, login, and related functions. It is installed automatically when the project is created.

01

Default Admin User Login & Password are as follows:

Module settings can be configured the following way:

  • SignUp Groups: defines the list of groups where the user can register;
  • SignUp: allows users to sign up and get accounts in the application;
  • Session timeout (minutes): defines the time after which the current user session will end if the user is idle; default 60 min;
  • Failed login delay (in ms): defines the delay time for responses after failed login attempts; default 0ms;
  • Email confirmation required: defines if the user has to confirm registration via email;
  • Signed-Up User Active: set active=true for each newly-created User object if enabled;
  • Groups tab allows to create and configure a list of user groups;

module_auth_settings

User and User Session models are created automatically once the Auth module is installed. You can find them in the Data Design tab. It is not possible to configure the default attributes of these models, but it is possible to add new ones.

data model

Pre-installed business processes related to User and User Session models are as follows:

  • User Model

    • DB: Delete User: deletes User object from the database based on its ID;

db_delete_user

    • DB: Update User: resets all the fields of a given model object in the database and updates them with given values (DB: Patch User has to be used to change the provided fields only and retain others as they are);

db_update_user

    • DB: Create User: creates a record in the database and returns the User model object (it requires to use Make User block to  create User model object according to input fields);

db_create_user

    • DB: Soft Delete User: updates DeletedAt field of the selected User model object instead of removing the whole record as DB: Delete User does;

db_soft_delete_user

    • DB: Bulk Delete User: bulk deletes the set of User model object records with the given IDs (ids array); failed_ids – an array of user IDs that will not be deleted;

db_bulk_delete_user

    • DB: Patch User: updates selected fields of the User model object in the database (DB: Update User has to be used to reset all the fields);

db_patch_user

    • DB: Search User: finds one or several User model objects in the database based on their fields and returns them;

db_search_user

    • DB: GetOne User: finds the User model object based on its ID and returns it;

db_getone_user

    • Expand User: returns all the fields of the selected User model object;

expand_user

    • Make User: makes the User model object based on input fields (it is required to use DB: Create User in order to make the record in the database);

make_user

  • User Session

    • DB: Delete User Session: deletes User Session object from the database based on its ID;

db_delete_user_session

    • DB: Update User Session: resets all the fields of a given model object in the database, and updates them with given values (DB: Patch User Session has to be used to change the provided fields only);

db_update_user_session

    • DB: Create User Session: creates a record in the database and returns the User Session model object (it requires to use Make User Session block to create User model object according to input fields);

db_create_user_session

    • DB: Soft Delete User Session: updates DeletedAt field of the selected User Session model object;

db_soft_delete_user_session

    • DB: Bulk Delete User Session: bulk deletes the set of User Session model object records with the given IDs (ids array); failed_ids array defines the set of IDs which will be ignored from deletion process;

db_bulk_delete_user_session

    • DB: Patch User Session: updates selected fields of the User Session model object in the database (DB: Update User Session has to be used to reset all the fields);

db_patch_user_session

    • DB: Search User Session: finds one or several User Session model objects in the database based on their fields and returns them;

db_search_user_session

    • DB: GetOne User Session: finds the User Session model object based on its ID and returns it;

db_getone_user_session

    • Expand User Session: returns all the fields of the selected User Session model object;

expand_user_session

    • Make User Session: makes the User Session model object based on input fields (it is required to use DB: Create User Session in order to make the record in the database);

make_user_session

  • Auth Module

    • Auth: Generate Auth Token: generates an authorization token (Auth Token) of the given length;

auth_generate_auth_token

    • Auth: Registration: registers a new user;

auth_registration

    • Auth: Authorization: checks if a given Auth Token exists and returns the user associated with it;

auth_authorization

    • Auth: Authentification: checks user’s login and password and returns Auth Token;

auth_authentification

    • Auth: Logout: terminates the current user’s session based on the Auth Token;

auth_logout

    • Auth: Get current user: returns current User model object;

auth_get_current_user

    • Auth: Remove user from group: removes a user from the selected group based on its ID;

auth_remove_user_from_group

    •  Auth: Add user to group: adds a user to the selected group based on its ID;

auth_add_user_to_group

    • Auth: Hash Password: converts password string into hash;

auth_hash_password

    • Auth: Restore Password: restores the password based on user’s login;

auth_restore_password

    • Auth: Change Password: changes user’s password;

auth_change_password

    • Auth: Probe Password: checks the association between password and hash;

auth_probe_pw

Auth Module, User and User Session endpoints

Pre-installed Endpoints of the Auth Module and User and User Session models are generated automatically once the project is created.

Auth Module

Request typeEndpointAssociated business process
/logout/Auth: Logout
/auth/Auth: Authentification
/register/Auth: Registration
/confirm/Auth: Get Current User
/user/change-password/Auth: Change Password
/user/restore-password/Auth: Restore Password
/user/profile/Auth: Get Current User

User

Request typeEndpointAssociated business process
/user/:id/DB: Update User
/user/:id/DB: Delete User
/user/:id/DB: GetOne User
/user/DB: Search User
/user/:id/DB: Patch User
/user/DB: Create User

User Session

Request typeEndpointAssociated business process
/user-session/:id/DB: Delete User Session
/user-session/:id/DB: GetOne User Session
/user-session/DB: Search User Session

/user-session/:id/DB: Patch User Session

/user-session/DB: Create User Session

/user-session/:id/DB: Update User Session

Auth Token

Auth Token is being used as an authorized user’s session token. It is possible to interact with the Auth Token, in the web-application business processes:

  • Get Auth Token returns current user’s session Auth Token;

get_auth_token

  • Set Auth Token rewrites current user’s session Auth Token;

set_auth_token

  • Remove Auth Token removes current user’s session Auth Token;

remove_auth_token

How to get current user

1. Go to the Business logic tab and drag the Auth: Get current user block.

get_current_user_be

2. Go to the Endpoints tab and expand the User section. Then, create a GET type method for the business process created in step 1. The endpoint URL would be /user_current.

get_current_user_mw

3. Go to the Web Apps tab and create a new business process with Server request GET /user_current to get the current user from the web application business process.

get_current_user_fe

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