Skip to content

Conversation

yangsijie666
Copy link

Summary

This PR fixes an incorrect error type returned when an unsupported grant type is encountered in the OAuth2 server.

Changes

  • Changed error type from ErrUnauthorizedClient to ErrUnsupportedGrantType in GetAccessToken function
  • Improves error message accuracy for OAuth2 grant type validation scenarios

Files Modified

  • server/server.go: Updated error return value in line 396

Why This Change?

The previous error type ErrUnauthorizedClient was semantically incorrect for cases where the grant type itself is not supported. According to OAuth2 specifications, unsupported_grant_type is the appropriate error code for this scenario.

Testing

  • Existing tests pass
  • Error handling behavior verified

Impact

  • Better error reporting for API consumers
  • Improved compliance with OAuth2 error handling standards
  • No breaking changes to existing functionality

…antType

Update GetAccessToken function to return more appropriate error type
for unsupported grant type scenarios.
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.

1 participant