Provide static constants for Oauth error codes

Issue #346 resolved
Ivan Miklec created an issue

Hi,
currently error codes in com.nimbusds.oauth2.sdk.http.HTTPResponse.OAuth2Error are hardcoded strings which does not make it possible to reuse them where we as a library user have a case where compile time constant is needed (e.g. switch case, annotation attributes). It would be nice if they could be provided like public static final variables inside OAuth2Error class. If this proposition is acceptable, I can provide PR.

Comments (7)

  1. Vladimir Dzhuvinov

    Hi Ivan,

    Could you post a snippet, the HTTPResponse class has status code ints and doesn’t deal with OAuth error codes?

  2. Vladimir Dzhuvinov

    It looks like you meant the `ErrorObject` constants declared in OAuth2Error .

    Yes, sure, send us a PR and we’ll review it and merge it if all is well. If there are modifications that need to be captured in a test, please include such tests.

  3. Ivan Miklec reporter

    Yes, ErrorObject instances that use String literals for error codes (e.g. "invalid_request” ). Thanks for the quick response, will do.

  4. Ivan Miklec reporter

    Hello, did some work but I was kind of busy last week, planned to tackle and finish this on Saturday. Is that ok?

  5. Yavor Vasilev

    Thanks!

    If all is well it will be released immediately so you can make use of the feature in your project without delay.

  6. Log in to comment