From 2da7e0b86b61763bfb8b266b4382a3c9ab175648 Mon Sep 17 00:00:00 2001 From: Micha de Vries Date: Mon, 23 Sep 2024 20:35:24 +0200 Subject: [PATCH] Fix JS examples --- .../doc-surrealdb/security/authentication.mdx | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/src/content/doc-surrealdb/security/authentication.mdx b/src/content/doc-surrealdb/security/authentication.mdx index 25871a9e7..ddc0cd723 100644 --- a/src/content/doc-surrealdb/security/authentication.mdx +++ b/src/content/doc-surrealdb/security/authentication.mdx @@ -43,13 +43,13 @@ Examples using the JavaScript SDK or a raw HTTP request. ```javascript const db = new Surreal(); db.connect('ws://localhost:8000/rpc', { - ns: 'test', - db: 'test', + namespace: 'test', + database: 'test', }); db.signin({ - user: 'john', - pass: 'VerySecurePassword!', + username: 'john', + password: 'VerySecurePassword!', }); ``` @@ -83,17 +83,17 @@ Notice how we need to pass along `NS` and `DB` properties here, to let SurrealDB ```javascript const db = new Surreal(); db.connect('ws://localhost:8000/rpc', { - ns: 'test', - db: 'test', + namespace: 'test', + database: 'test', }); db.signin({ // Because we are signin in a database user, we need to let SurrealDB know on which database this user is located. - NS: 'test', - DB: 'test', + namespace: 'test', + database: 'test', - user: 'mary', - pass: 'VerySecurePassword!', + username: 'mary', + password: 'VerySecurePassword!', }); ``` @@ -185,21 +185,23 @@ Examples using the JavaScript SDK or a raw HTTP request. ```js const db = new Surreal(); db.connect('ws://localhost:8000/rpc', { - ns: 'test', - db: 'test', + namespace: 'test', + database: 'test', }); db.signup({ - NS: 'test', - DB: 'test', + namespace: 'test', + database: 'test', // Provide the name of the access method - AC: 'user', + access: 'user', // Provide the variables used by the signup query - name: 'John Doe', - email: 'john@doe.org', - password: 'VerySecurePassword!', + variables: { + name: 'John Doe', + email: 'john@doe.org', + password: 'VerySecurePassword!', + } }); ``` #### HTTP Request @@ -222,20 +224,22 @@ Examples using the JavaScript SDK or a raw HTTP request. ```js const db = new Surreal(); db.connect('ws://localhost:8000/rpc', { - ns: 'test', - db: 'test', + namespace: 'test', + database: 'test', }); db.signin({ - NS: 'test', - DB: 'test', + namespace: 'test', + database: 'test', // Provide the name of the access method - AC: 'user', + access: 'user', // Provide the variables used by the signin query - email: 'john@doe.org', - password: 'VerySecurePassword!', + variables: { + email: 'john@doe.org', + password: 'VerySecurePassword!', + } }); ```