-
Notifications
You must be signed in to change notification settings - Fork 30
Login beacon #52
Comments
Login is defined by the contents of a signed HTTP-only cookie, so this script can only be loaded from auth.hasgeek.com (or whatever the app's login server is). |
Implementation:
|
Scenario 1: User is not logged into either Lastuser or client app
|
Scenario 2: User is logged into both Lastuser and client app, script is not cached
|
Scenario 3: User is logged into Lastuser but not client app, script is not cached
|
Scenario 4: User is not logged into Lastuser but logged into client app, script is not cached
|
Scenario 4: User is logged into Lastuser but not client app, script is cached logged out
Possible fix: the logged out version is always served with no-cache headers. |
Scenario 5: User is logged out on Lastuser but logged in on client, script is cached logged in
Possible fix: don't cache logged in version either. What's the point of the separate |
The only sensible fix to the cache problems appears to be to (a) use database-backed sessions (#89) and (b) push notifications to client apps when a user logs in/out. |
Push notifications can be used to force logout a user, but not for login, since we have a ready identifier (the cookie) for logout, but nothing for login. Therefore a possible solution is that the logged out beacon script is served with no-cache, while the logged in version is cached. However, logged out pageviews far exceed logged in pageviews, so this makes performance slightly worse for the more common use scenario. |
#89 has resolved the logout problem. When the user now logs out of Lastuser, they also logout of (most) client apps -- anything running the new Flask-Lastuser with login sessions. The login beacon's job is now to facilitate login alone. |
Looking at this afresh:
|
The only way to read Lastuser's cookies from a client app website appears to be by using an iframe and reading that iframe's document.cookie, so that requires another endpoint that is loaded into an iframe:
|
Scenario 4 is still broken. Corresponding ticket in hasgeek/flask-lastuser#31 |
Sites are often out of sync with Lastuser w.r.t the user's logged in state. The user may be logged into the site but not the app or vice versa.
The login beacon is a JS script loaded from the Lastuser server in all app sites that attempts to fix this:
Questions:
The text was updated successfully, but these errors were encountered: