Skip to content

Auth AM database

Authorization of AM database user

To get the value of request header x-am-user-authorization, use g.req.auth.authAMDB.

const database_user_auth = g.req.auth.authAMDB;

Setting sample object

  • API Maker admin can make require the database authorization for any API using set below code in Settings or Secret.
  • Provide the groups name comma separated in the 'groupsColumn' field and provide the 'instance', 'database', 'table' from which that 'groupsColumn' exist.
{
    "authTokenType": "AM_DB",
    "authTokenAMDB": {
        "instance": "INSTANCE_NAME",
        "database": "DATABASE_NAME",
        "collection": "COLLECTION_NAME",
        "usernameColumn": "USER_NAME_COLUMN",
        "passwordColumn": "USER_PASSWORD_COLUMN",
        "groupsColumn": "COMMA_SEPARATED_GROUPS",
        "select": {
            "COLUMN_NAME1": 1,
            "COLUMN_NAME2": 1
        }
    }
}

Get token

  • Get a token of API Maker's database user(application user).
  • For more information click here.
{
    "authTokenType": "AM_DB",
    "authTokenAMDB": {
        "instance": "INSTANCE_NAME",
        "database": "DATABASE_NAME",
        "collection": "COLLECTION_NAME",
        "usernameColumn": "USER_NAME_COLUMN",
        "passwordColumn": "USER_PASSWORD_COLUMN",
        "u": "USER_NAME",
        "p": "PASSWORD"
    }
}