Skip to content

OAuth store jwt token #344

Merged
jigar-f merged 4 commits intomainfrom
jigar/oauth-jwt
Feb 26, 2026
Merged

OAuth store jwt token #344
jigar-f merged 4 commits intomainfrom
jigar/oauth-jwt

Conversation

@jigar-f
Copy link
Contributor

@jigar-f jigar-f commented Feb 26, 2026

This pull request enhances the handling of JWT tokens in user authentication workflows by introducing a new JwtTokenKey setting and updating relevant logic to ensure JWT tokens are properly stored and managed during login, OAuth callback, and logout operations.

JWT Token Management Improvements:

  • Added a new constant JwtTokenKey to common/settings/settings.go for storing JWT tokens in settings.
  • Updated the setData method in api/user.go to save JWT tokens from login responses and log errors if saving fails.
  • Modified the OAuthLoginCallback method to store the OAuth JWT token in settings after successful authentication.

Logout Process Enhancement:

  • Updated the Logout method to include the JWT token in the logout request and log the logout request for debugging purposes.

Copilot AI review requested due to automatic review settings February 26, 2026 06:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates authentication state management by introducing a dedicated settings key for JWT tokens and wiring JWT persistence/usage into login, OAuth callback, and logout flows.

Changes:

  • Add JwtTokenKey to settings constants for persisting JWT tokens.
  • Persist JWT tokens into settings from login responses and OAuth callback.
  • Include the JWT token in the logout request.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
common/settings/settings.go Adds a new settings key for persisting the JWT token.
api/user.go Stores JWT tokens during auth flows and sends JWT token during logout.
Comments suppressed due to low confidence (1)

api/user.go:326

  • a.Reset() clears legacy settings but does not clear settings.JwtTokenKey, so the JWT can remain on disk after logout and be reused unintentionally. Clear the JWT token on logout (or update APIClient.Reset() to also reset JwtTokenKey) after a successful SignOut.
	a.Reset()
	a.salt = nil

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jigar-f
Copy link
Contributor Author

jigar-f commented Feb 26, 2026

Thanks!

@jigar-f jigar-f merged commit 6a8df83 into main Feb 26, 2026
2 checks passed
@jigar-f jigar-f deleted the jigar/oauth-jwt branch February 26, 2026 12:53
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