question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Random user logout

See original GitHub issue

✅ Prerequisites

  • Did you perform a cursory search of open issues? Is this question already asked elsewhere?
  • Are you reporting to the correct repository (magic-sdk)?

❓ Question

We are using magic in an Electron app and the user is sometimes randomly logged out. We are unable to replicate the error, but it keeps happening. We already checked our code, but it is possible that the error is there.

We found several things that are not clear and that may be the cause:

Re-authenticating users

In the magic documentation it is not clear how long the session lasts and when we have to re-authenticate.

  • Does it always expire after 7 days if no other action happens?
  • Is the magic.user.isLoggedIn() or magic.user.getIdToken() causing the actual re-authentication? Will this reauthentication provision a new didToken?

didToken claims

We have looked at the decoded claims from the didToken and the ext field was always only 15 minutes in the future. Even after waiting for 15 minutes the user was still logged in - magic.user.isLoggedIn() is returning true.

  • How does this work? Is the didToken used solely as an “access token” and you are storing the actual information authentication information used for generating these tokens in the IndexedDB?
  • Where can we see how long until the current user’s session expires and he needs to log in again?

The Electron environment also does not seems to be the problem. The IndexedDB where you are storing the sessions are persistent in Electron and even deleting the application cache does not log out the user.

🌎 Environment

Software Version(s)
magic-sdk 4.0.2
Browser Electron
yarn
Operating System macOS 11.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
hcotecommented, Mar 27, 2021

@terrierscript here’s the new guide for custom sessions w JWT https://magic.link/posts/magic-jwt

1reaction
hcotecommented, Mar 11, 2021

Hey @terrierscript, I had removed the JWT from the guide to rely on Magic for sessions and tracking if the user is logged in primarily to simplify the example. I’ll add a new guide to site ASAP specifically on Magic + JWT for session management.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows 10 randomly automatically logs user out while I'm ...
When you open 'gpedit.msc' from a Run-window or command prompt you can walk through the tree to 'Computer Configuration' -> 'Windows ...
Read more >
Windows 10 randomly logs user out while they are using it
Both users state that their Dell 5590 laptop is logging them out randomly around 3x times a day. We troubleshoot with the following:....
Read more >
Customer keeps getting randomly logged out of Web Client ...
I'm the admin, and no one has been logging out users. Understand, the error is immediate. When the user attempts to log in,...
Read more >
Random Logouts - Linux Mint Forums
My system and it just logs me out without warning. i use Mint XFCE 18.3 I have no scheduled logouts set. - Lid...
Read more >
Windows 10 randomly logs off - Microsoft Community
I have a 1 year old HP laptop running windows 10. It will randomly log off for no apparent reason, even when the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found