Skip to content

Commit 4811e38

Browse files
authored
Update Rust client SDK docs for SpacetimeDB#2118 (#130)
1 parent e93c330 commit 4811e38

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

docs/sdks/rust/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl DbConnectionBuilder {
7575
}
7676
```
7777

78-
Chain a call to `.on_connect(callback)` to your builder to register a callback to run when your new `DbConnection` successfully initiates its connection to the remote module. The callback accepts three arguments: a reference to the `DbConnection`, the `Identity` by which SpacetimeDB identifies this connection, and a private access token which can be saved and later passed to [`with_credentials`](#method-with_credentials) to authenticate the same user in future connections.
78+
Chain a call to `.on_connect(callback)` to your builder to register a callback to run when your new `DbConnection` successfully initiates its connection to the remote module. The callback accepts three arguments: a reference to the `DbConnection`, the `Identity` by which SpacetimeDB identifies this connection, and a private access token which can be saved and later passed to [`with_token`](#method-with_token) to authenticate the same user in future connections.
7979

8080
This interface may change in an upcoming release as we rework SpacetimeDB's authentication model.
8181

@@ -93,15 +93,15 @@ impl DbConnectionBuilder {
9393

9494
Chain a call to `.on_connect(callback)` to your builder to register a callback to run when your `DbConnection` disconnects from the remote module, either as a result of a call to [`disconnect`](#method-disconnect) or due to an error.
9595

96-
#### Method `with_credentials`
96+
#### Method `with_token`
9797

9898
```rust
9999
impl DbConnectionBuilder {
100-
fn with_credentials(self, credentials: Option<(Identity, String)>) -> Self;
100+
fn with_token(self, token: Option<impl ToString>>) -> Self;
101101
}
102102
```
103103

104-
Chain a call to `.with_credentials(credentials)` to your builder to provide an `Identity` and private access token to authenticate with, or to explicitly select an anonymous connection. If this method is not called or `None` is passed, SpacetimeDB will generate a new `Identity` and sign a new private access token for the connection.
104+
Chain a call to `.with_token(token)` to your builder to provide an OpenID Connect compliant JSON Web Token to authenticate with, or to explicitly select an anonymous connection. If this method is not called or `None` is passed, SpacetimeDB will generate a new `Identity` and sign a new private access token for the connection.
105105

106106
This interface may change in an upcoming release as we rework SpacetimeDB's authentication model.
107107

docs/sdks/rust/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ fn connect_to_db() -> DbConnection {
376376
.on_disconnect(on_disconnected)
377377
.with_uri(SPACETIMEDB_URI)
378378
.with_module_name(DB_NAME)
379-
.with_credentials(credentials.load().unwrap())
379+
.with_token(credentials.load().unwrap())
380380
.build().expect("Failed to connect");
381381
conn.run_threaded();
382382
conn

0 commit comments

Comments
 (0)