Start a conversation

Handling User Information in Aurora Instances

Overview

The issue arises when the current logged-in user information is not updated in the __NEXT_DATA__.props.pageProps.apolloState context object after logging into an Aurora instance. 

This is expected behavior, and the object is not designed to reflect the authenticated user state dynamically. Instead, use authUser from auroraContext.pageContext or listen for the authChanged event to access current user details.

Information

Issue: Current logged-in user information not updating in __NEXT_DATA__.props.pageProps.apolloState after login

Resolution Steps:

  1. Access Current User Information:
    • Use authUser from auroraContext.pageContext to access the current authenticated user. This object updates reactively after login.
  2. Listen for Authentication Changes:
    • Implement a listener for the authChanged event. This event notifies your code when the authentication state changes, allowing you to update your logic accordingly.
  3. Implementation Guidance:
    • Update your implementation to use the recommended methods for accessing user context in Aurora.
    • Ensure your code listens for the authChanged event to handle dynamic user data requirements.

Note: The __NEXT_DATA__.props.pageProps.apolloState object will continue to show user ID = -1 after login, as it is not designed to reflect the authenticated user state.

Frequently Asked Questions

Q1: How do I access the current logged-in user information in Aurora?
A1: Use authUser from auroraContext.pageContext or listen for the authChanged event to access current user details.

Q2: Why does the __NEXT_DATA__.props.pageProps.apolloState object not update with the current user information?
A2: This object is not designed to dynamically reflect the authenticated user state after login. It will continue to show user ID = -1.

Q3: What should I do if I need dynamic user data in my application?
A3: Update your implementation to use auroraContext.pageContext.authUser or listen for the authChanged event to handle dynamic user data requirements.
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Ciprian Nastase

  2. Posted
  3. Updated

Comments