From 5e346034cbf0a7c696157c113f4b3e00efbf0205 Mon Sep 17 00:00:00 2001 From: Gazihan Alankus Date: Mon, 14 Oct 2024 00:06:48 +0300 Subject: [PATCH 1/2] session.auth.authenticatedUserId is not there anymore. --- docs/06-concepts/11-authentication/02-basics.md | 3 ++- .../version-2.1.0/06-concepts/11-authentication/02-basics.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/06-concepts/11-authentication/02-basics.md b/docs/06-concepts/11-authentication/02-basics.md index b6d15c9b..f4dd5855 100644 --- a/docs/06-concepts/11-authentication/02-basics.md +++ b/docs/06-concepts/11-authentication/02-basics.md @@ -6,7 +6,8 @@ The `Session` object provides information about the current user. A unique `user ```dart Future myMethod(Session session) async { - var userId = await session.auth.authenticatedUserId; + final authenticationInfo = await session.authenticated; + final userId = authenticationInfo?.userId; ... } ``` diff --git a/versioned_docs/version-2.1.0/06-concepts/11-authentication/02-basics.md b/versioned_docs/version-2.1.0/06-concepts/11-authentication/02-basics.md index b6d15c9b..f4dd5855 100644 --- a/versioned_docs/version-2.1.0/06-concepts/11-authentication/02-basics.md +++ b/versioned_docs/version-2.1.0/06-concepts/11-authentication/02-basics.md @@ -6,7 +6,8 @@ The `Session` object provides information about the current user. A unique `user ```dart Future myMethod(Session session) async { - var userId = await session.auth.authenticatedUserId; + final authenticationInfo = await session.authenticated; + final userId = authenticationInfo?.userId; ... } ``` From 786c3000fb5e845c8136a21b94630e9481b3c01d Mon Sep 17 00:00:00 2001 From: Gazihan Alankus Date: Thu, 17 Oct 2024 20:20:33 +0300 Subject: [PATCH 2/2] The previous paragraph was still referring to the code that was replaced. Updated it to reflect the new code. --- docs/06-concepts/11-authentication/02-basics.md | 2 +- .../version-2.1.0/06-concepts/11-authentication/02-basics.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/06-concepts/11-authentication/02-basics.md b/docs/06-concepts/11-authentication/02-basics.md index f4dd5855..b84b779c 100644 --- a/docs/06-concepts/11-authentication/02-basics.md +++ b/docs/06-concepts/11-authentication/02-basics.md @@ -2,7 +2,7 @@ Serverpod automatically checks if the user is logged in and if the user has the right privileges to access the endpoint. When using the `serverpod_auth` module you will not have to worry about keeping track of tokens, refreshing them or, even including them in requests as this all happens automatically under the hood. -The `Session` object provides information about the current user. A unique `userId` identifies a user. You should use this id whenever you a referring to a user. Access the id of a signed-in user through the `auth` field of the `Session` object. +The `Session` object provides information about the current user. A unique `userId` identifies a user. You should use this id whenever you a referring to a user. Access the id of a signed-in user through the `authenticated` asynchronous getter of the `Session` object. ```dart Future myMethod(Session session) async { diff --git a/versioned_docs/version-2.1.0/06-concepts/11-authentication/02-basics.md b/versioned_docs/version-2.1.0/06-concepts/11-authentication/02-basics.md index f4dd5855..b84b779c 100644 --- a/versioned_docs/version-2.1.0/06-concepts/11-authentication/02-basics.md +++ b/versioned_docs/version-2.1.0/06-concepts/11-authentication/02-basics.md @@ -2,7 +2,7 @@ Serverpod automatically checks if the user is logged in and if the user has the right privileges to access the endpoint. When using the `serverpod_auth` module you will not have to worry about keeping track of tokens, refreshing them or, even including them in requests as this all happens automatically under the hood. -The `Session` object provides information about the current user. A unique `userId` identifies a user. You should use this id whenever you a referring to a user. Access the id of a signed-in user through the `auth` field of the `Session` object. +The `Session` object provides information about the current user. A unique `userId` identifies a user. You should use this id whenever you a referring to a user. Access the id of a signed-in user through the `authenticated` asynchronous getter of the `Session` object. ```dart Future myMethod(Session session) async {