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

Enable session sharing between GV and OSF #227

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open

Conversation

adlius
Copy link
Collaborator

@adlius adlius commented Feb 8, 2025

No description provided.

Copy link
Collaborator

@brianjgeiger brianjgeiger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One potential optimization, but overall looks good to me.

Comment on lines 14 to +16
UserReference.objects.get_or_create(user_uri=_user_uri)
request.session["user_reference_uri"] = _user_uri
if not request.session.get("user_reference_uri"):
request.session["user_reference_uri"] = _user_uri
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to get_or_create the UserReference if it's already on the session? Might be able to save a db call here if not.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably you still do need to do that, as I think about it more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to run the scenario in my mind, I think we do. Here a potential scenario immediately after deployment to prod:

  • A logged out user logs into OSF, user_reference_uri is set on the shared session
  • User (now authenticated) then makes a call to GV, at this point a UserReference instance is not yet created for this user on the GV side

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

Successfully merging this pull request may close these issues.

3 participants