dbsync_srvapp.auto_register_user()

Enables automatic user/app creation for the DB Sync server-side app.

Syntax

  1. app_id defines the app id for the DB Sync server-side app; this is a string.
  2. user_id defines the user id; this is a string.
  3. user_name is the user description. If NULL, a default description is generated; this is a string.

Usage

Use this function to get user/app definition automatically created in the DB Sync system tables, if this user/app pair does not yet exist.

Important:

Enable user/app auto-registration ONLY if the user id is properly authenticated throught SSO or your own login/pswd system: There is no way for the DB Sync system to check the user id passed as parameter. When this function is called, the DB Sync system assumes that the provided user id is valid and verified.

The app_id parameter identifies the server-side application in the DB Sync system. This app_id is created with the DB Sync app definition console.

The user_id parameter identifies the end user which is using the current server-side app.

After using the auto_register_user() function, the server-side app should call the dbsync_srvapp.register_central_app_params() function.

If you are not using GAS/SSO to authenticate server-side DB Sync users, the application must identify the end user to get the user_id. For example, call the dbsync_core.enter_user_credentials() function to ask the end user for a login/password.

When using GAS/SSO to authenticate server-side DB Sync users, the user_id should be the OIDC subject assigned to the SSO user. In the context of the server-side app, the OIDC subject can be found in the OIDC_SUB environment variable:
LET user_id = fgl_getenv(“OIDC_SUB“)

For more details about server-side app and user setup, see Set up DB Sync for server-side apps.