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

Inappropriate Display of Signup Button for Users with Cookies #177

Closed
captain-Akshay opened this issue Jan 17, 2024 · 11 comments
Closed

Inappropriate Display of Signup Button for Users with Cookies #177

captain-Akshay opened this issue Jan 17, 2024 · 11 comments
Assignees
Labels
framework/gatsby help wanted Extra attention is needed issue/stale Issue has not had any activity for an extended period of time kind/bug Something isn't working language/javascript Javascript related

Comments

@captain-Akshay
Copy link
Contributor

Current Behavior

The website currently displays a signup button regardless of whether the user has an account indicating prior signup. This behavior is not consistent with user expectations and may lead to confusion.

Possible Solution:

Implement logic to check for the presence of a signup-related cookie. If the cookie is present, do not display the signup button. Ensure this check is performed consistently across page loads.

Screenshots/Logs

image

Environment

  • Host OS: Mac Linux Windows
  • Platform: Docker or Kubernetes
  • Meshery Server Version: stable-v
  • Meshery Client Version: stable-v

Contributor Guides and Resources

@captain-Akshay captain-Akshay added the kind/bug Something isn't working label Jan 17, 2024
@leecalcote leecalcote added help wanted Extra attention is needed framework/gatsby language/javascript Javascript related labels Jan 20, 2024
@prajjwalyd
Copy link

prajjwalyd commented Jan 23, 2024

Hello!

I've been exploring the signup button behavior issue, and I'd like to propose a solution:

Step 1:
Check for the presence of the signup-related cookie on mount.

Step 2:
Initialize the showSignUpButton state based on the presence of the cookie.

Step 3:
When the user submits the signup form, set the signup-related cookie, and update the showSignUpButton state accordingly.


If this solution aligns with your expectations, I'd be excited to take ownership of this issue and work on implementing it. Please let me know if any adjustments are needed or if you have any specific considerations...

@prajjwalyd
Copy link

prajjwalyd commented Feb 2, 2024

Hey @captain-Akshay ,
any updates on this issue? Is it still valid?

@Shabab007
Copy link

Shabab007 commented Feb 8, 2024

Hello @captain-Akshay @leecalcote
I have looked into the issue . achieving the desired functionality of checking the presence of the signup-related cookie for not displaying the signup button involves a series of critical steps. . here are some findings

  1. After signing up the api response header is setting the http only cookie named "__cf_bm" which is expected.
    here is the screenshot
Screenshot 2024-02-08 at 7 09 37 PM
  1. Given that this application is crafted with Create React App (CRA), a client-side application, the inherent limitation is that JavaScript cannot access or retrieve HTTP-only cookies directly. Consequently, determining the user's cookie status becomes a challenge.

To address this, impactful suggestions include:

  • In order to achieve and parse the cookie we need to use Next js or serverside technology .
  • We can use hybrid auth system like jwt with cookie in order get the user creds, permissions, authorization and the http only cookie will be set for the subsequent api request for that user
  • Simple solution would to send a proper response from the signup api for example user details or jwt or session details which we can retrive in Create react app or client side react. Right now the signup api only sending accepted response and we are not retriving any response after hitting the api . Here are the screenshots
Screenshot 2024-02-08 at 7 54 40 PM Screenshot 2024-02-08 at 7 55 00 PM

@leecalcote
Copy link
Member

Hey @captain-Akshay , any updates on this issue? Is it still valid?

Yes, indeed, it certainly is.

@leecalcote
Copy link
Member

The need here isn't with respect as to whether someone has signed up, but whether they have been awarded access to the Playground or not. The cookie for this will come from meshery.layer5.io. While you're digging in here, @Shabab007, please note the sibling issue here - layer5io/layer5#5295. We'll want for these to both be handled in the same way. Both sites use Gatsby and both will need to look for the same cookie/access/token.

@Shabab007
Copy link

Hi @leecalcote ,
After carefully looking at the issue and sibling issue . I found that playground is in different domain play.meshery.io and the cookie we are expecting that should come from meshery.layer5.io domain. Indeed, cookies are typically restricted to the domain from which they were set due to the same-origin policy, a security measure implemented by web browsers. Thats why we can't access the cookies from different domain to toggle off the playground button.

@leecalcote
Copy link
Member

Maybe, maybe not.

@leecalcote
Copy link
Member

My money is on the latter.

@prajjwalyd
Copy link

@leecalcote From what I've understood, the goal here is to show the signup button based on the presence of a cookie that will come from meshery.layer5.io, but we want to access that from https://play.meshery.io/... in this situation, I think @Shabab007's concern is spot on as we can't access cookies between domains without any Centralized Authentication or cross-domain messaging kind of things.
Please correct me if I've misunderstood anything.

Copy link

stale bot commented Mar 31, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the issue/stale Issue has not had any activity for an extended period of time label Mar 31, 2024
Copy link

stale bot commented Apr 11, 2024

This issue is being automatically closed due to inactivity. However, you may choose to reopen this issue.

@stale stale bot closed this as completed Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework/gatsby help wanted Extra attention is needed issue/stale Issue has not had any activity for an extended period of time kind/bug Something isn't working language/javascript Javascript related
Projects
None yet
Development

No branches or pull requests

4 participants