diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/AuthorizationCodeAuthenticationFilterTests.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/AuthorizationCodeAuthenticationFilterTests.java
index b735f56037..783010cde1 100644
--- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/AuthorizationCodeAuthenticationFilterTests.java
+++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/AuthorizationCodeAuthenticationFilterTests.java
@@ -33,7 +33,7 @@ import org.springframework.security.oauth2.client.authentication.OAuth2UserAuthe
import org.springframework.security.oauth2.client.registration.ClientRegistration;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.security.oauth2.core.AccessToken;
-import org.springframework.security.oauth2.core.OAuth2Error;
+import org.springframework.security.oauth2.core.OAuth2ErrorCode;
import org.springframework.security.oauth2.core.endpoint.AuthorizationRequest;
import org.springframework.security.oauth2.core.endpoint.OAuth2Parameter;
import org.springframework.security.oauth2.core.user.OAuth2User;
@@ -82,7 +82,7 @@ public class AuthorizationCodeAuthenticationFilterTests {
filter.setAuthenticationFailureHandler(failureHandler);
MockHttpServletRequest request = this.setupRequest(clientRegistration);
- String errorCode = OAuth2Error.INVALID_GRANT_ERROR_CODE;
+ String errorCode = OAuth2ErrorCode.INVALID_GRANT;
request.addParameter(OAuth2Parameter.ERROR, errorCode);
request.addParameter(OAuth2Parameter.STATE, "some state");
MockHttpServletResponse response = new MockHttpServletResponse();
diff --git a/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/OAuth2Error.java b/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/OAuth2Error.java
index 9836e9b0e0..3957271fb3 100644
--- a/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/OAuth2Error.java
+++ b/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/OAuth2Error.java
@@ -31,14 +31,6 @@ import org.springframework.util.Assert;
* @see Section 11.4 OAuth Extensions Error Registry
*/
public final class OAuth2Error {
- // Standard error codes
- public static final String INVALID_REQUEST_ERROR_CODE = "invalid_request";
- public static final String INVALID_CLIENT_ERROR_CODE = "invalid_client";
- public static final String INVALID_GRANT_ERROR_CODE = "invalid_grant";
- public static final String UNAUTHORIZED_CLIENT_ERROR_CODE = "unauthorized_client";
- public static final String UNSUPPORTED_GRANT_TYPE_ERROR_CODE = "unsupported_grant_type";
- public static final String INVALID_SCOPE_ERROR_CODE = "invalid_scope";
-
private final String errorCode;
private final String description;
private final String uri;
diff --git a/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/OAuth2ErrorCode.java b/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/OAuth2ErrorCode.java
new file mode 100644
index 0000000000..0642f2f0c3
--- /dev/null
+++ b/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/OAuth2ErrorCode.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2012-2017 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.security.oauth2.core;
+
+/**
+ * Standard error codes defined by the OAuth 2.0 Authorization Framework.
+ *
+ * @author Joe Grandja
+ * @since 5.0
+ */
+public interface OAuth2ErrorCode {
+
+ String INVALID_REQUEST = "invalid_request";
+
+ String UNAUTHORIZED_CLIENT = "unauthorized_client";
+
+ String ACCESS_DENIED = "access_denied";
+
+ String UNSUPPORTED_RESPONSE_TYPE = "unsupported_response_type";
+
+ String INVALID_SCOPE = "invalid_scope";
+
+ String SERVER_ERROR = "server_error";
+
+ String TEMPORARILY_UNAVAILABLE = "temporarily_unavailable";
+
+ String INVALID_CLIENT = "invalid_client";
+
+ String INVALID_GRANT = "invalid_grant";
+
+ String UNSUPPORTED_GRANT_TYPE = "unsupported_grant_type";
+
+}