Skip to content

Commit

Permalink
[JS SDK] : Auth info update (#1025)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekwuno authored Nov 21, 2024
1 parent a5443f5 commit 720bfda
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
13 changes: 11 additions & 2 deletions src/content/doc-sdk-javascript/core/handling-authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,22 @@ async db.signup({`{ namespace, database, [ scope | access ], [...] }`})
</tr>
<tr>
<td colspan="2" scope="row" data-label="Arguments">
<code>access</code>
<code>access </code>
<Label label="required" />
</td>
<td colspan="2" scope="row" data-label="Description">
The access to sign up to. Also pass any variables used in the access under the `variables` key. Only supported from SurrealDB 2.x onwards
</td>
</tr>
<tr>
<td colspan="2" scope="row" data-label="Arguments">
<code>variables</code>
<Label label="optional" />
</td>
<td colspan="2" scope="row" data-label="Description">
The variables to pass to the access definition
</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -475,4 +484,4 @@ await db.authenticate('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJTdXJyZWFs
## Learn more
Learn more about authentication in SurrealDB in our [security best practices](/docs/surrealdb/reference-guide/security-best-practices#authentication) documentation and in the [security](/docs/surrealdb/security/authentication#expiration) section of the SurrealDB documentation.
Learn more about authentication in SurrealDB in our [security best practices](/docs/surrealdb/reference-guide/security-best-practices#authentication) documentation and in the [security](/docs/surrealdb/security/authentication#expiration) section of the SurrealDB documentation.
6 changes: 3 additions & 3 deletions src/content/doc-sdk-javascript/methods/signin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ const token = await db.signin({
const token = await db.signin({
namespace: 'surrealdb',
database: 'docs',
scope: 'user',
access: 'user',

// Also pass any properties required by the scope definition
// Also pass any properties required by the access definition
variables: {
email: 'info@surrealdb.com',
pass: '123456',
Expand All @@ -130,4 +130,4 @@ const token = await db.signin({
});
```

You can invalidate the authentication for the current connection using the [`invalidate()` method](/docs/sdk/javascript/methods/invalidate).
You can invalidate the authentication for the current connection using the [`invalidate()` method](/docs/sdk/javascript/methods/invalidate). Learn more about [handling authentication](/docs/sdk/javascript/core/handling-authentication).
4 changes: 2 additions & 2 deletions src/content/doc-sdk-javascript/methods/signup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async db.signup({`{ namespace, database, [ scope | access ], [...] }`})
const token = await db.signup({
namespace: 'surrealdb',
database: 'docs',
scope: 'user',
access: 'user',

// Also pass any properties required by the scope definition
variables: {
Expand All @@ -93,4 +93,4 @@ const token = await db.signup({
});
```

You can invalidate the authentication for the current connection using the [`invalidate()` method](/docs/sdk/javascript/methods/invalidate).
You can invalidate the authentication for the current connection using the [`invalidate()` method](/docs/sdk/javascript/methods/invalidate). Learn more about [handling authentication](/docs/sdk/javascript/core/handling-authentication).

0 comments on commit 720bfda

Please sign in to comment.