Skip to content

five-on-it / apps/api/src/auth / Auth

Interface: Auth ​

Defined in: apps/api/src/auth.ts:61

An account provider.

Methods ​

guest() ​

guest(deviceId, name?, create?): Promise<Session>

Defined in: apps/api/src/auth.ts:66

Signs a device in as a guest (the account is made the first time, unless create is false: a device without an account is refused then, NoAccount).

Parameters ​

deviceId ​

string

name? ​

string

create? ​

boolean

Returns ​

Promise<Session>


issue() ​

issue(account, seconds, grant): Promise<string>

Defined in: apps/api/src/auth.ts:90

A session token for an account already signed in, lasting seconds, tied to an OAuth grant: what verify answers for it names the grant.

Parameters ​

account ​

Account

seconds ​

number

grant ​

string

Returns ​

Promise<string>


linkSteam() ​

linkSteam(account, token, steamid): Promise<void>

Defined in: apps/api/src/auth.ts:83

Links a Steam account to an account signed in (its session token): signing in through Steam lands in that account from then on. Throws when the Steam account is linked already.

Parameters ​

account ​

Account

token ​

string

steamid ​

string

Returns ​

Promise<void>


login() ​

login(email, password, name?, create?): Promise<Session>

Defined in: apps/api/src/auth.ts:71

Signs a user in with an e-mail and a password (the account is made the first time, unless create is false: an e-mail without an account is refused then).

Parameters ​

email ​

string

password ​

string

name? ​

string

create? ​

boolean

Returns ​

Promise<Session>


steam() ​

steam(steamid, name, linked?): Promise<Session>

Defined in: apps/api/src/auth.ts:78

Signs a Steam account in, the API having checked who it is (the account, keyed steam-<steamid>, is made the first time). linked is the account an e-mail account linked the Steam account to, for a provider that keeps no links of its own (dev); Nakama finds it itself.

Parameters ​

steamid ​

string

name ​

string

linked? ​

Account

Returns ​

Promise<Session>


verify() ​

verify(token): Promise<Verified | undefined>

Defined in: apps/api/src/auth.ts:85

The account a session token belongs to; undefined for a bad or expired one.

Parameters ​

token ​

string

Returns ​

Promise<Verified | undefined>