Skip to content

How to get the authenticated user info on the server side after the signin? #13

Answered by sandros94
dodanex asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @dodanex
first off, sorry if I still haven't created official docs. I'm working on it tho 🙏

Any methods that do require user's authentication are mainly for client-side usage, since SurrealDB can handle them.
But this server-side only use case is something I need to simplify, since it is already usable but not as simple as I would like it to be.

It is not working because you need to pass the sessionToken to the next useSurrealRPC call

-  const result = await useSurrealRPC(event, { method: 'info' })
+  const result = await useSurrealRPC(event,
+    { method: 'info' },
+    {
+      database: {
+        NS: config.SURREALDB_NAMESPACE,
+        DB: config.SURREALDB_DATABASE,
+        SC: …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dodanex
Comment options

@sandros94
Comment options

Answer selected by dodanex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants