Skip to content

Lua API

Luca edited this page Jan 11, 2022 · 1 revision

This project does not have any Lua / Garry's Mod dependencies and will work on any gamemode.

🟠 Clientside

Functions

GWAA.GetSession() » Returns the current session JWT. This is the main purpose of the project, send this to your own APIs for authentication.

Hooks

GWAA:InitialAuthenticated » (string jwt) » Runs after the client received the first JWT during the current play session of the server. Usually, this is less than a second after clientside InitPostEntity.

GWAA:Authenticated » (string jwt) » Runs when a new JWT / session was received.

🔵 Serverside

Functions

GWAA.AuthPlayer(Player ply) » Runs GWAA.CreatePlayerSession internally to get a JWT which is then networked to the client for clientside usage. If the client already has a JWT it will be overwritten.

GWAA.CreatePlayerSession(Player ply, function callback) » Requests a new session from the API and returns it. Callback values: boolean success, string jwt

GWAA.GetAPIServerURL() » Returns the URL of the API server, always has a trailing slash.

GWAA.GetAPIStatus(function callback) » Makes a request to the /status route of the API. Callback values: boolean isAvailiabe, table apiInfo

Clone this wiki locally