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

Remember me #1656

Open
2 tasks done
FlxMgdnz opened this issue Oct 1, 2024 · 21 comments · May be fixed by #1661
Open
2 tasks done

Remember me #1656

FlxMgdnz opened this issue Oct 1, 2024 · 21 comments · May be fixed by #1661
Assignees
Labels
750 points enhancement New feature or request go Pull requests that update Go code hacktoberfest hanko-elements 🕹️ oss.gg

Comments

@FlxMgdnz
Copy link
Member

FlxMgdnz commented Oct 1, 2024

Checklist

  • I could not find a solution in the existing issues or docs.
  • I agree to follow this project's Code of Conduct.

Description

Users should have the option of ending their session automatically when the browser is closed. Depending on the config, in the current implementation either the frontend SDK pulls the JWT from the x-auth-token header or the backend stores the JWT as cookie. In both cases, the session will be active as long as the JWT is valid.

Describe your ideal solution

As a new, optional feature, we can introduce a Remember me checkbox on the login page in Hanko Elements. When enabled, the user can control via the checkbox whether the session should remain valid for the duration of the JWT (old behavior) or whether the JWT should be stored as a session cookie and deleted when the browser is closed.

Proposed new backend config option:

session:
  enable_remember_me: true / false (Default: false)

Workarounds or alternatives

No response

Hanko Version

1.0.2

Additional Context

No response

@FlxMgdnz FlxMgdnz added enhancement New feature or request go Pull requests that update Go code hanko-elements hacktoberfest 🕹️ oss.gg 500 points labels Oct 1, 2024
@Mujhtech
Copy link

Mujhtech commented Oct 2, 2024

Hey @FlxMgdnz, I would love to work on this issue. Can you assign it to me?

@Mujhtech
Copy link

Mujhtech commented Oct 2, 2024

/assign

@oss-gg oss-gg bot assigned Mujhtech Oct 2, 2024
Copy link

oss-gg bot commented Oct 2, 2024

Assigned to @Mujhtech! Please open a draft PR linking this issue within 48h ⚠️ If we can't detect a PR from you linking this issue in 48h, you'll be unassigned automatically 🕹️ Excited to have you ship this 🚀

@Mujhtech Mujhtech linked a pull request Oct 2, 2024 that will close this issue
@FlxMgdnz
Copy link
Member Author

FlxMgdnz commented Oct 4, 2024

Hey @Mujhtech I've added a bit more information to the issue description.

@FlxMgdnz
Copy link
Member Author

FlxMgdnz commented Oct 7, 2024

fyi we've added 250 points to the issue

@Mujhtech
Copy link

Mujhtech commented Oct 7, 2024

Screenshot 2024-10-07 at 13 36 56

@FlxMgdnz I have made few progress by adding enable_remember_me to session config

type Session struct {
	// ...other session config data
	// `enable_remember_me` determines whether remember me functionality should be enable in hanko element ui
	// which allows users to control the session duration whether the JWT should be store in session cookie and deleted
	// when browser is closed or not.
	EnableRememberMe bool `yaml:"enable_remember_me" json:"enable_remember_me,omitempty" koanf:"enable_remember_me" split_words:"true" jsonschema:"default=false"`
}

When the value is true, it add remember action to the login init state else suspend remember me action.

What do you think?

@Mujhtech
Copy link

Mujhtech commented Oct 7, 2024

Also, this is what I noticed: the current implementation is using js-cookie to store the token. By my testing, I experienced that if the tab is open while I close the browser, the cookie stays but if I close the tab before closing the browser, the cookie expires

@teamhanko teamhanko deleted a comment from oss-gg bot Oct 17, 2024
@teamhanko teamhanko deleted a comment from vamus092 Oct 17, 2024
@teamhanko teamhanko deleted a comment from oss-gg bot Oct 17, 2024
@teamhanko teamhanko deleted a comment from kunalarya873 Oct 17, 2024
@teamhanko teamhanko deleted a comment from oss-gg bot Oct 17, 2024
@teamhanko teamhanko deleted a comment from prathamesh0987 Oct 17, 2024
@teamhanko teamhanko deleted a comment from oss-gg bot Oct 17, 2024
@teamhanko teamhanko deleted a comment from TechWithAkash Oct 17, 2024
@teamhanko teamhanko deleted a comment from oss-gg bot Oct 17, 2024
@teamhanko teamhanko deleted a comment from suraj-xd Oct 17, 2024
@teamhanko teamhanko deleted a comment from oss-gg bot Oct 17, 2024
@teamhanko teamhanko deleted a comment from RudrakshDev Oct 17, 2024
@teamhanko teamhanko deleted a comment from oss-gg bot Oct 17, 2024
@teamhanko teamhanko deleted a comment from Piyush07p Oct 17, 2024
@teamhanko teamhanko deleted a comment from oss-gg bot Oct 17, 2024
@teamhanko teamhanko deleted a comment from birajkashyap Oct 17, 2024
@HSRAKTU
Copy link

HSRAKTU commented Oct 17, 2024

/assign

Copy link

oss-gg bot commented Oct 17, 2024

This issue is already assigned to another person. Please find more issues here.

@Ashutoshdas-dev
Copy link

/assign

Copy link

oss-gg bot commented Oct 18, 2024

This issue is already assigned to another person. Please find more issues here.

@sanyamhbtu
Copy link

/assign

Copy link

oss-gg bot commented Oct 19, 2024

This issue is already assigned to another person. Please find more issues here.

@AndrewHamal
Copy link

/assign

Copy link

oss-gg bot commented Oct 19, 2024

This issue is already assigned to another person. Please find more issues here.

@vamus092
Copy link

/assign

Copy link

oss-gg bot commented Oct 22, 2024

This issue is already assigned to another person. Please find more issues here.

@Kartikey1306
Copy link

/assign

Copy link

oss-gg bot commented Oct 23, 2024

This issue is already assigned to another person. Please find more issues here.

@prithak01
Copy link

/assign

Copy link

oss-gg bot commented Oct 28, 2024

This issue is already assigned to another person. Please find more issues here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
750 points enhancement New feature or request go Pull requests that update Go code hacktoberfest hanko-elements 🕹️ oss.gg
Projects
Status: 🆕 New
Development

Successfully merging a pull request may close this issue.

9 participants