Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BBB meeting launch URL not working in D2L, EdX on Firefox #197

Open
Mariam05 opened this issue Feb 17, 2023 · 1 comment
Open

BBB meeting launch URL not working in D2L, EdX on Firefox #197

Mariam05 opened this issue Feb 17, 2023 · 1 comment

Comments

@Mariam05
Copy link
Collaborator

Joining a meeting from D2L or EdX on Firefox results in a 401 unauthorized error (and I suspect this problem will also be on Safari, although we have not tested it). This is due to the State Partitioning feature of Firefox (https://developer.mozilla.org/en-US/docs/Web/Privacy/Storage_Access_Policy/Errors/CookiePartitionedForeign).

This is the way to access permission: https://developer.mozilla.org/en-US/docs/Web/API/Document/requestStorageAccess. However, it's not as simple as it looks. Permission must be requested only with a user interaction (ie. when they press the button), and it does not work to open the meeting automatically after permission has been granted.

The reason that Moodle does not have this problem seems to be because they implemented the following:
In addition, sandboxed <iframe>s cannot be granted storage access by default for security reasons. The API therefore also adds the allow-storage-access-by-user-activation sandbox token. The embedding website needs to add this to allow storage access requests to be successful, along with allow-scripts and allow-same-origin to allow it to call the API, and execute in an origin that can have cookies: (from https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API)

@Mariam05
Copy link
Collaborator Author

This is what I have so far, but it requires the user to accept the cookies, and then refresh the browser before clicking on 'join meeting' again. I have tried triggering these actions from the js but that will still return a 401.

    /*
    With Dynamic State Partitioning enabled, Firefox provides embedded resources with a separate storage bucket for every top-level website, causing the request to be denied if it comes from a third party. Embedded third-parties may request access to the top-level storage bucket, which is what we're doing with the requestAccess() method.
    */
    function requestAccess(){
         document.requestStorageAccess().then(
          () => { 
            console.log('access granted!');
            // the user needs to reload and then press the button again for it to work 
           },
          () => { console.log('access denied') }
        );
    }


    document.hasStorageAccess().then((hasAccess) => {
        if (!hasAccess && (isFirefox || isSafari)) {
            console.log("no access");
            // storage access has not been granted
            $('#meeting_join_form').one('submit', function(e) {
                e.preventDefault();
                requestAccess();  
            });
        } else {
            console.log("Already has access");
        }
      });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant