CreateInviteTokenAsync
Methods
public Task<string> CreateInviteTokenAsync(TimeSpan? timeToLive = null, CancellationToken cancellationToken = default)
Creates an invite token for this Lobby.
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan? | timeToLive | How long the token keeps working. Leave it out for coherence Cloud's default, currently an hour. coherence Cloud currently accepts from a second up to a day, and fails the request otherwise. |
| CancellationToken | cancellationToken | Optional parameter to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task<string> | The token, to hand out as you see fit. |
Remarks
A token is not tied to whoever uses it, is multi-use until it expires, and cannot be taken back on its own. Closing the Lobby invalidates every token minted for that Lobby.
Password verification is skipped when joining with an invite token.
Only owners can create invites, unless the Lobby was created with InvitePermissions set to AllMembers. Anyone else gets Coherence.Runtime.ErrorCode.LobbyInvitePolicy, a player no longer in the Lobby Coherence.Runtime.ErrorCode.LobbyNotFound, and minting too quickly (currently over 30 a minute) Coherence.Runtime.ErrorCode.LobbyRateLimited.