Have you tried using the useAuth()
hook to fetch currentuser or userMetadata as per
API
The following values are available from the useAuth hook:
currentUser: An object containing information about the current user as set on the api side, or null if the user is not authenticated.
userMetadata: An object containing the user's metadata (or profile information) fetched directly from an instance of the auth provider client, or null if the user is not authenticated.
as as shown in the tutorial:
import { Link, routes } from '@redwoodjs/router'
import { useAuth } from '@redwoodjs/auth'
const BlogLayout = ({ children }) => {
const { logIn, logOut, isAuthenticated, currentUser } = useAuth()
return (
<div>
<h1>
<Link to={routes.home()}>Redwood Blog</Link>
</h1>
<nav>
<ul>
<li>
<Link to={routes.about()}>About</Link>
</li>
<li>
<Link to={routes.contact()}>Contact</Link>
</li>
<li>
<button onClick={isAuthenticated ? logOut : logIn}>
{isAuthenticated ? 'Log Out' : 'Log In'}
</button>
</li>
{isAuthenticated && <li>{currentUser.email}</li>}
</ul>
</nav>
<main>{children}</main>
</div>
)
}
export default BlogLayout
```
?
You may want `userMetadata` instead.
You can then set the result and `console.log(currentUser)` or `console.log(userMetadata)`.