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

Improve security of token by using secure http-only cookie #95

Open
4 tasks done
brentmitchell25 opened this issue Jul 12, 2024 · 0 comments
Open
4 tasks done

Improve security of token by using secure http-only cookie #95

brentmitchell25 opened this issue Jul 12, 2024 · 0 comments

Comments

@brentmitchell25
Copy link

Checklist

  • I have looked into the Readme and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

This repo still stores the JWT in the browser. A few modifications can be made to make it follow the BFF patern for more secure token use.

Describe the ideal solution

The secret store could set the token when the user logs in:

store.Options(sessions.Options{
  Path:     "/",
  HttpOnly: true,
  Secure:   true,
})

The logout will also need to clear the session as well:

// get session details (cookie)
authSession := sessions.Default(ctx)

// clear details (logout)
authSession.Clear()
authSession.Options(sessions.Options{
  MaxAge:   -1, // This instructs the browser to delete the cookie
  Path:     "/",
  HttpOnly: true,
  Secure:   true,
})

Alternatives and current workarounds

No response

Additional context

No response

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