-
Notifications
You must be signed in to change notification settings - Fork 62
feat: add v2 RefreshToken endpoint and improve error msg #77
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
Conversation
…ge parsing and display.
There was a problem hiding this 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 pull request enhances error handling and introduces a versioned API endpoint for token refresh. The changes focus on providing more user-friendly error messages across the stack while maintaining backward compatibility through the addition of a /v2/auth/refresh endpoint alongside the existing v1 endpoint.
Key changes:
- Added default user-friendly error messages for all error codes in both backend (Go) and frontend (TypeScript)
- Implemented error message cleaning to strip technical gRPC prefixes before presenting errors to users
- Introduced a new
/v2/auth/refreshendpoint while maintaining the existing/v1/auth/refreshendpoint for backward compatibility
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
internal/libs/shared/error.go |
Added default error messages map and logic to use friendly messages when no detail is provided |
internal/api/server.go |
Added cleanErrorMessage function to strip gRPC prefixes from error messages |
internal/api/actor.go |
Updated authentication error messages to be more user-friendly |
webapp/_webapp/src/libs/apiclient.ts |
Added error message cleaning and error code-to-title mapping for better UI error display |
proto/auth/v1/auth.proto |
Added additional HTTP binding for v2 refresh token endpoint |
pkg/gen/api/auth/v1/auth.pb.gw.go |
Generated gateway code for the new v2 endpoint |
pkg/gen/api/auth/v1/auth.pb.go |
Generated protobuf code reflecting the v2 endpoint addition |
webapp/_webapp/src/pkg/gen/apiclient/auth/v1/auth_pb.ts |
Generated TypeScript protobuf code with v2 endpoint support |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…d remove frontend refresh token endpoint.
…om/PaperDebugger/paperdebugger into fix-refreshToken-and-errorHandling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…emove nil error message fallback.
…om/PaperDebugger/paperdebugger into fix-refreshToken-and-errorHandling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… default backend error messages and updating frontend error titles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request introduces several improvements to error handling and API usability, focusing on delivering more user-friendly error messages and enhancing the authentication API. The most significant changes include improving error messages throughout the stack, adding default user-friendly messages for common error codes, and introducing a new versioned endpoint for token refresh in the authentication API.
Error handling and user experience improvements:
error.go, ensuring that when no detailed error is provided, a clear, helpful message is returned to the user. [1] [2]server.goto use a newcleanErrorMessagefunction, which strips technical gRPC prefixes from error messages before returning them to clients. [1] [2]actor.go) by providing more descriptive, user-focused feedback for various authentication failures.apiclient.ts) to clean up error messages and provide more descriptive error toast titles based on error codes, improving the clarity of error notifications in the UI.API enhancements and versioning:
RefreshTokenRPC in the authentication API, introducing a new/v2/auth/refreshendpoint alongside the existing/v1/auth/refresh. This includes all necessary changes in the protobuf definitions and generated gateway code to support the new endpoint. [1] [2] [3] [4] [5] [6] [7]These changes collectively improve the developer and user experience by making errors easier to understand and by supporting API evolution with versioned endpoints.
Note
Enhances auth API versioning and error readability.
/_pd/api/v2/auth/refreshas an additional binding forRefreshToken(proto updated; regenerated Go gateway and TS client files)cleanErrorMessageinserver.goErrorCodeinshared/error.go;makeErrorFuncuses them when no detail providedactor.go(token required, audience, ID format, user errors)apiclient.ts) cleans gRPC prefixes and mapsErrorCodeto toast titles; minor API cleanup inquery/api.ts(remove unusedrefreshTokenhelper)Written by Cursor Bugbot for commit fedfd2d. This will update automatically on new commits. Configure here.