add some missing getSession warnings (#21436)

This commit is contained in:
Charis authored and GitHub committed 2024-02-21 20:13:08 -05:00
1 parent f71458ef1a
commit a5a2cd688e
2 files changed
+2 -2

No files matched your search

@@ -73,7 +73,7 @@ export async function middleware(req) {
const supabase = createMiddlewareClient({ req, res })
// Refresh session if expired - required for Server Components
await supabase.auth.getSession()
await supabase.auth.getUser()
return res
}
+1 -1
View File
@@ -825,7 +825,7 @@ functions:
notes: |
- This method fetches the user object from the database instead of local session.
- This method is useful for checking if the user is authorized because it validates the user's access token JWT on the server.
- Should be used only when you require the most current user data. For faster results, `getSession().session.user` is recommended.
- Should always be used when checking for user authorization on the server. On the client, you can instead use `getSession().session.user` for faster results. `getSession` is insecure on the server.
examples:
- id: get-the-logged-in-user-with-the-current-existing-session
name: Get the logged in user with the current existing session