Skip to content

getUserIdentity

Sam Der edited this page Nov 20, 2024 · 1 revision

If you are not already familiar with how user authentication works on the site overall, please refer to User Authentication Routes.

The application page, the portal, and the administration pages all require a user to be logged in for them to view. Some, particularly the administration pages, require elevated privileges (e.g. only organizers can view the administration pages and no one else).

The getUserIdentity function makes an API call using Axios to /api/user/me, a backend route that returns the UID of the user, their role, and their status.

Each page that uses this function must be a server component as the Axios instance uses an App Router function called cookies to send cookies alongside requests to the backend.