res://addons/w4gd/supabase/identity.gd

Inherits: RefCounted

Represents a Supabase identity.

Description

This includes the Supabase role (anonymous, authenticated, service_role) and the user ID if the client is authenticated with Supabase.

Properties

String

access_token

""

String

apikey

""

Dictionary

data

int

expire

0

String

refresher_token

""

String

role

""

StringName

uid

&""

Methods

void

get_access_token ( )

void

get_api_key ( )

String

get_email ( )

StringName

get_uid ( )

void

is_anon ( )

void

is_authenticated ( )

void

is_expired ( )

void

is_service ( )

void

is_valid ( )

void

reset_access_token ( )

void

set_access_token ( String p_token )


Signals

identity_changed ( )

Emitted when the current identity has changed (logging in, logging out, etc).


Property Descriptions

String access_token = ""

The access token.


String apikey = ""

The API key.


Dictionary data

The JWT payload from Supabase.


int expire = 0

When the current access token expires in UNIX time (seconds since the epoch).


String refresher_token = ""

The refresher token.


String role = ""

The role (anonymous, authenticated or service_role).


StringName uid = &""

The UUID representing the current user in the database (if authenticated).


Method Descriptions

void get_access_token ( )

Gets the acccess token.


void get_api_key ( )

Gets the API key.


String get_email ( )

Gets the email address of the current user (if authenticated).


StringName get_uid ( )

Gets the UUID of the current user in the database (if authenticated).


void is_anon ( )

Returns true the identity is valid and represents an anonymous user; otherwise, false.


void is_authenticated ( )

Returns true the identity is valid and represents an authenticated user; otherwise, false.


void is_expired ( )

Returns true if the access token is expired; otherwise, false.


void is_service ( )

Returns true the identity is valid and represents the service role; otherwise, false.


void is_valid ( )

Returns true if the identity is valid; otherwise, false.


void reset_access_token ( )

Resets the access token to the API key.


void set_access_token ( String p_token )

Sets the access token to the given JWT string.