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

    Track session length for reporting

    Scheduled Pinned Locked Moved Unsolved Q&A
    2 Posts 1 Posters 1.1k Views
    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.
    • danD
      dan
      last edited by

      We are using FusionAuth refresh tokens as our session. Users can connect from multiple devices. We want to record the duration (plus other metadata) of each session for reporting purposes.

      How can we do so?

      --
      FusionAuth - Identity Without Constraints
      https://fusionauth.io

      danD 1 Reply Last reply
      Reply Quote 0
      • danD
        dan @dan
        last edited by

        The easiest way to do so is to listen for the jwt.refresh-token.revoke event.

        It's documented here: https://fusionauth.io/docs/v1/tech/events-webhooks/events/jwt-refresh-token-revoke

        In particular, you have the date of the revocation (the end of the session). If it is an individual session revocation, you have the start date, which is the startInstant inside the events refreshToken field.

        If your webhook processor does the subtraction of these two values, you'll be able to find and record the duration of the session length.

        --
        FusionAuth - Identity Without Constraints
        https://fusionauth.io

        1 Reply Last reply
        Reply Quote 0
        • danD dan moved this topic from Q&A on
        • danD dan moved this topic from Frequently Asked Questions (FAQ) on

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post