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

fix: unauthorized error message #500

Merged
merged 3 commits into from
Feb 9, 2024
Merged

Conversation

sanjay-k1910
Copy link
Contributor

What?

Updated unauthorized error message when a user tries to use API with the invalid access token
Previous response:

{
  "statusCode": 500,
  "message": "Cannot read properties of null (reading 'iss')",
  "error": "Internal Server error"
}

Refactored response:

{
  "statusCode": 401,
  "message": "Invalid access token",
  "error": "Unauthorized"
}

Why?

If an unauthorized user tries to access API then it should return a proper error message.

Signed-off-by: sanjay-k1910 <[email protected]>
@@ -59,7 +59,8 @@ export const ResponseMessages = {
invitationStatusUpdateInvalid: 'Status update is invalid. Request is already',
resetSamePassword: 'New password should not be the current password',
resetPasswordLink: 'Unable to create reset password token',
invalidResetLink: 'Invalid reset password link or expired'
invalidResetLink: 'Invalid reset password link or expired',
Copy link
Collaborator

Choose a reason for hiding this comment

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

update verbose
"Invalid or expired reset password link"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved.

@@ -59,7 +59,8 @@ export const ResponseMessages = {
invitationStatusUpdateInvalid: 'Status update is invalid. Request is already',
resetSamePassword: 'New password should not be the current password',
resetPasswordLink: 'Unable to create reset password token',
invalidResetLink: 'Invalid reset password link or expired'
invalidResetLink: 'Invalid reset password link or expired',
invalidAccessToken: 'Invalid access token'
Copy link
Collaborator

Choose a reason for hiding this comment

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

'Unauthorized' or 'Authentication failed' message is also fine. No need to provide technical details to user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved.

Signed-off-by: sanjay-k1910 <[email protected]>
Copy link

sonarcloud bot commented Feb 9, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@ankita-p17 ankita-p17 merged commit 9768cc9 into develop Feb 9, 2024
2 checks passed
@bhavanakarwade bhavanakarwade deleted the unauthorized-error-message branch March 8, 2024 14:55
KulkarniShashank pushed a commit that referenced this pull request Sep 11, 2024
* fix: unauthorized error message

Signed-off-by: sanjay-k1910 <[email protected]>

* fix: sonarlint issue

Signed-off-by: sanjay-k1910 <[email protected]>

* refactor: error messages

Signed-off-by: sanjay-k1910 <[email protected]>

---------

Signed-off-by: sanjay-k1910 <[email protected]>
KulkarniShashank pushed a commit that referenced this pull request Sep 11, 2024
* fix: unauthorized error message

Signed-off-by: sanjay-k1910 <[email protected]>

* fix: sonarlint issue

Signed-off-by: sanjay-k1910 <[email protected]>

* refactor: error messages

Signed-off-by: sanjay-k1910 <[email protected]>

---------

Signed-off-by: sanjay-k1910 <[email protected]>
Signed-off-by: KulkarniShashank <[email protected]>
KulkarniShashank pushed a commit that referenced this pull request Sep 11, 2024
* fix: unauthorized error message

Signed-off-by: sanjay-k1910 <[email protected]>

* fix: sonarlint issue

Signed-off-by: sanjay-k1910 <[email protected]>

* refactor: error messages

Signed-off-by: sanjay-k1910 <[email protected]>

---------

Signed-off-by: sanjay-k1910 <[email protected]>
Signed-off-by: KulkarniShashank <[email protected]>
KulkarniShashank pushed a commit that referenced this pull request Sep 11, 2024
* fix: unauthorized error message

Signed-off-by: sanjay-k1910 <[email protected]>

* fix: sonarlint issue

Signed-off-by: sanjay-k1910 <[email protected]>

* refactor: error messages

Signed-off-by: sanjay-k1910 <[email protected]>

---------

Signed-off-by: sanjay-k1910 <[email protected]>
Signed-off-by: KulkarniShashank <[email protected]>
KulkarniShashank pushed a commit that referenced this pull request Sep 12, 2024
* fix: unauthorized error message

Signed-off-by: sanjay-k1910 <[email protected]>

* fix: sonarlint issue

Signed-off-by: sanjay-k1910 <[email protected]>

* refactor: error messages

Signed-off-by: sanjay-k1910 <[email protected]>

---------

Signed-off-by: sanjay-k1910 <[email protected]>
Signed-off-by: KulkarniShashank <[email protected]>
KulkarniShashank pushed a commit that referenced this pull request Sep 12, 2024
* fix: unauthorized error message

Signed-off-by: sanjay-k1910 <[email protected]>

* fix: sonarlint issue

Signed-off-by: sanjay-k1910 <[email protected]>

* refactor: error messages

Signed-off-by: sanjay-k1910 <[email protected]>

---------

Signed-off-by: sanjay-k1910 <[email protected]>
Signed-off-by: KulkarniShashank <[email protected]>
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.

2 participants