Skip to content

feat: set_token command#63

Draft
onx2 wants to merge 1 commit into
mainfrom
feat/set-token-command
Draft

feat: set_token command#63
onx2 wants to merge 1 commit into
mainfrom
feat/set-token-command

Conversation

@onx2
Copy link
Copy Markdown
Owner

@onx2 onx2 commented May 24, 2026

In preparation for bevy_stdb_auth crate, we'll need some way to update the token without causing a reconnect. This exposes a command that will mutate the internal token for use in reconnects later on when needed.

So the general flow is something like:

  • Listen for message that the access token has been refreshed from bevy_stdb_auth
  • When refreshed, take the token and call set_token with it to update the state

When there is a disconnect + connect for spacetime, this new token will not be expired which means we can safely connect.

fn update_token(stdb_cmds: StdbCmds, msgs: ReadStdbAuthTokenRefreshedMessage) {
  for msg in msgs.read() {
    // new token from the active session... now subsequent reconnects will succeed
    // when the original token would have failed due to expiry.
    stdb_cmds.set_token(msg.session.access_token);
  }

}

@onx2 onx2 self-assigned this May 24, 2026
@onx2 onx2 added the enhancement New feature or request label May 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant