Skip to content

Configuration

Luca edited this page Nov 23, 2024 · 4 revisions

Configuring this project is straightforward and should take less than 2-3 minutes.

Configuring the Garry's Mod addon

Configuration file: gmod_web_api_auth/lua/gmod_web_api_auth/sv_config_gmod_web_api_auth.lua

Option Description
GWAA.APIServerURL The URL / IP of the API server to get the sessions from
GWAA.APIKey The API key used to authenticate with the API. This has to be one of the API keys of the Node.js app configuration!
If you do not want to store the API key in the config file, you can set the value to data-file and create a file containing the API key in your-sever/garrysmod/data/gwaa_api_key.txt

Configuring the Node.js app

Configuration file 1: gmod_web_api_auth_app/.env (Template to copy: gmod_web_api_auth_app/.env.example)

Key Description
JWT_SECRET The secret your JWTs will be signed with.
JWT_EXPIRATION The time in seconds after a JWT / session will expire. This does not have to be high (Recommended to be < 1 hour) because the Garry's Mod addon will automatically fetch a new session for the user just before the current one expires.
BIND_HOST Host / IP to bind the server to (Optional, defaults to 0.0.0.0)
BIND_PORT Port to bind the server to (Optional, defaults to 3020)

Configuration file 2: gmod_web_api_auth_app/config.json

Key Description
api_keys An array of API keys to allow authentication from the Garry's Mod addon. The array has to contain the API key set in the Garry's Mod addons config! The length of each API key has to be between 16 and 128 characters.

Clone this wiki locally