• Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login
FusionAuth
  • Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login

Preventing lastLoginInstant Updates on User Creation in FusionAuth

Scheduled Pinned Locked Moved Solved
Q&A
1
2
4.4k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W
    wesley
    last edited by 19 Feb 2025, 21:45

    When creating a user via the API, the response includes a token field, which causes the lastLoginInstant value to be populated. However, this is misleading because the user has never actually logged in—they were only created.

    Questions:

    1. Is there a way to avoid setting lastLoginInstant immediately upon user creation?
    2. Are there any workarounds to track actual logins separately?
    W 1 Reply Last reply 19 Feb 2025, 21:50 Reply Quote 0
    • W
      wesley @wesley
      last edited by 19 Feb 2025, 21:50

      Yes, this behavior occurs because creating a user via the API returns an access token, which indirectly updates lastLoginInstant.

      Workarounds:

      1. Use the Import API Instead
        • The Import API allows you to create users without generating an access token, preventing the lastLoginInstant field from being updated.
        • API Reference: Import Users API
      2. Track Logins Using Webhooks
        • If lastLoginInstant is needed for business logic or reporting, consider tracking actual user logins via webhooks instead.
        • FusionAuth provides user.login.* webhook events to capture real login activity.
        • API Reference: User Login Webhooks

      By using the Import API for user creation and webhooks for tracking real logins, you can avoid the unintended side effect of lastLoginInstant being updated upon user creation.

      1 Reply Last reply Reply Quote 0
      • W wesley has marked this topic as solved on 19 Feb 2025, 21:50
      2 out of 2
      • First post
        2/2
        Last post