Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

gd-pocketbase

Normalises PocketBase auth responses for Godot 4.

AuthResponseModule.normalize() turns either a native PocketBase {"token", "record"} response or a trusted backend-proxy {"access_token", "user"} response into one shape: {"access_token", "user": {"id", "email", "username"}}. That is the whole addon. The session store, client ID and JWT helpers it used to carry were a copy of a backend-neutral core that now lives in @aviorstudio/gd-session; install that beside this addon to persist what normalize() returns.

Installation

gdam add @aviorstudio/gd-pocketbase
gdam add @aviorstudio/gd-session

Quick start

const AuthResponseModule = preload(
	"res://addons/@aviorstudio_gd-pocketbase/src/auth_response_module.gd"
)
const SessionStoreModule = preload(
	"res://addons/@aviorstudio_gd-session/src/session_store_module.gd"
)

var auth := AuthResponseModule.normalize(response_json)
var config := SessionStoreModule.SessionStoreConfig.new()
config.native_adapter = NativeCredentials.new()  # see gd-session's README
var saved := SessionStoreModule.new(config).save(auth)
if not saved.is_ok():
	push_error(saved.detail)

Games own HTTP transport, refresh and revoke policy, and server trust. A production backend should keep PocketBase superuser credentials private; this addon never needs them.

License

See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages