Overview

After session times out, the XB page stuck on the error message. Only after a redirect, the login page appears. Ideally, clicking "Try Again" should take the user directly to the login page.

Steps to reproduce:

  1. log in
  2. use XB, e.g. go to /xb/node/1/editor
  3. use the browser console to rename the session cookie, for example, add a prefix
  4. a few seconds later, you'll see the above

Below are the network errors :

{
    "status": 403,
    "data": {
        "errors": [
            "This route can only be accessed by authenticated users."
        ]
    }
}
[
    "The 'edit xb_page' permission is required."
]

Proposed resolution

User interface changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mayur-sose created an issue. See original summary.

wim leers’s picture

Title: After source session timeout, XB page stuck on the error message » After session times out, the XB UI is stuck
Component: … to be triaged » Page builder
Priority: Normal » Minor
Issue summary: View changes
Issue tags: +Usability, +JavaScript
StatusFileSize
new64.9 KB

Thanks, interesting edge case! 😄

mayur-sose’s picture

Issue summary: View changes

bnjmnm made their first commit to this issue’s fork.

bnjmnm’s picture

Assigned: Unassigned » bnjmnm

bnjmnm’s picture

Version: 0.x-dev » 1.x-dev

bnjmnm changed the visibility of the branch 3532618-after-session-times to hidden.

larowlan’s picture

Neat approach. Can we get a kernel test added for the authentication checker?

bnjmnm’s picture

Neat approach. Can we get a kernel test added for the authentication checker?

Yep,! There's a bunch of other tests that need updating too - I just didn't want to do all that refactoring until I got a +1 but now that I have one I'll hop on that.

bnjmnm’s picture

Assigned: bnjmnm » Unassigned
Status: Active » Needs review
wim leers’s picture

Assigned: Unassigned » bnjmnm
Status: Needs review » Needs work

Looking good! Missing some cacheability bits — provided pointers to prior art.

Two tests are failing:

  1. one thanks to the new testAuthenticationRequiredPermission() (👍) — it identified one route definition that still needs to be updated
  2. one which I suspect is due to a bug in the new access check: https://git.drupalcode.org/project/experience_builder/-/merge_requests/1...
wim leers’s picture

Issue tags: +Needs screenshots

Would also be nice to get a GIF of this new UI functionality in action 😇

bnjmnm’s picture

Assigned: bnjmnm » Unassigned
Status: Needs work » Needs review

Failing test is just a flaky Playwright

wim leers’s picture

Assigned: Unassigned » bnjmnm
Status: Needs review » Needs work

Reopened a thread, because I don't understand the answer: https://git.drupalcode.org/project/experience_builder/-/merge_requests/1...

A mild concern about relying on https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Authentication#... at https://git.drupalcode.org/project/experience_builder/-/merge_requests/1... — but I'm okay with merging as-is.

Just need to get clarity on that one thing 😇

wim leers’s picture

Assigned: bnjmnm » wim leers

Ahhhhh!

  public function testAssetLibrary(): void {
    // Delete the library created during install.
    $library = AssetLibrary::load(AssetLibrary::GLOBAL_ID);
    \assert($library instanceof AssetLibrary);
    $library->delete();

That is why! Reverting my revert, and merging 👍

wim leers’s picture

Assigned: wim leers » Unassigned
Status: Needs work » Reviewed & tested by the community
wim leers’s picture

Issue summary: View changes
Issue tags: -Needs screenshots
StatusFileSize
new48.62 KB

Manually tested, works well 👍

  • wim leers committed 2a9ff9e2 on 1.x authored by bnjmnm
    Issue #3532618 by bnjmnm, wim leers, mayur-sose: After session times out...
wim leers’s picture

Status: Reviewed & tested by the community » Fixed

🎉

mayur-sose’s picture

After renaming the cookie and reloading the page, I am getting the following session timeout error:

{
    "errors": [
        "You must be logged in to access this resource."
    ]
}

Error 401: You must be logged in to access this resource.

And after clicking on the "Go to login" button, the page is correctly redirected to the login page. This behaviour is working as expected. Now, the page is not getting stuck on the error page.

lauriii’s picture

Status: Fixed » Needs work
StatusFileSize
new91.16 KB

We need to adjust the errors that are displayed to user in this situation. This isn't really an unexpected error.. This is just the users session timing out?

wim leers’s picture

Yeah, I was thinking that too — but this is such a massive improvement compared to where we were before that I didn't want to push back over this. 😅

lauriii’s picture

+1 for landing the fix as it is but it would be great to plan for doing #24 too.

wim leers’s picture

Title: After session times out, the XB UI is stuck » [Needs design] After session times out, the XB UI is stuck
Status: Needs work » Postponed (maintainer needs more info)
Issue tags: +Needs design

Okay — but what do you expect that to look like? We were flying blind here: empty proposed solution in the issue summary, no designs.

So: the hard part is done — now we just need to tweak it to no longer have this less-than-great UX 😊

Project: Experience Builder » Drupal Canvas

Experience Builder has been renamed to Drupal Canvas in preparation for its beta release. You can now track issues on the new project page.