Project

General

Profile

Actions

Bug #22699

closed

Invite modal doesn't fetch correct membership info from mapped domain

Added by Raymond Hoh 4 days ago. Updated about 19 hours ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
Group Invitations
Target version:
Start date:
2025-05-02
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

See https://redmine.gc.cuny.edu/issues/22691#note-5.

When on a mapped domain and attempting to navigate to the "Users > Add New" screen, the invite modal pops up, but when attempting to go to step 2, there are no group or site memberships being listed.

In the browser console, I see a 403 for a request to https://commons.gc.cuny.edu/wp-json/caco/v1/app-config/:

{"code":"rest_cookie_invalid_nonce","message":"Cookie check failed","data":{"status":403}}

CACO's nonce is generated here: https://github.com/cuny-academic-commons/cac-onboarding/blob/1ed119a17e1974b0442cb3acba745a236676828d/src/Modal.php#L76

This modal works fine when using the subdomain.

Since a login to a mapped domain is using a different session token and thus, a different nonce, this is where the 403 is coming from.

It might be possible to use the same session token if the user is initiating SSO login to the mapped domain via the admin bar's 'My Sites' menu when setting the auth cookie, but if the user is logging in manually to the mapped domain, this 403 will always occur.

Boone, how do you want to proceed here?

Actions #2

Updated by Boone Gorges about 20 hours ago

Thanks for laying this out, Ray.

Since the issue here is cross-domain requests, let's just get rid of cross-domain requests. We'll set endpointBase to get_home() ... rather than bp_get_root_url() .... The way the cac-onboarding plugin is written, those endpoints are available on every site in the network anyway. I just made the change as a hotfix in production and it appears to be working across all subdomains as well as mapped domains. But perhaps you could give it a sanity check before I commit any changes?

Actions #3

Updated by Raymond Hoh about 20 hours ago

We'll set endpointBase to get_home() ... rather than bp_get_root_url()

I was thinking about this same workaround after I posted the ticket. Let's go with this!

Actions #4

Updated by Boone Gorges about 19 hours ago

  • Status changed from New to Resolved
Actions

Also available in: Atom PDF