diff --git a/lib/src/exception.dart b/lib/src/exception.dart index 3f33f4c8..3e140784 100644 --- a/lib/src/exception.dart +++ b/lib/src/exception.dart @@ -7,7 +7,7 @@ class AuthorizationException extends AngelHttpException { AuthorizationException(this.errorResponse, {StackTrace stackTrace, int statusCode, error}) : super(error ?? errorResponse, - stackTrace: stackTrace, message: '', statusCode: statusCode ?? 401); + stackTrace: stackTrace, message: '', statusCode: statusCode ?? 400); @override Map toJson() { diff --git a/lib/src/server.dart b/lib/src/server.dart index d42883c8..07ec42a5 100644 --- a/lib/src/server.dart +++ b/lib/src/server.dart @@ -66,7 +66,7 @@ abstract class AuthorizationServer { 'Authorization code grants are not supported.', state, ), - statusCode: 405, + statusCode: 400, ); } @@ -87,7 +87,7 @@ abstract class AuthorizationServer { 'Authorization code grants are not supported.', state, ), - statusCode: 405, + statusCode: 400, ); } @@ -103,7 +103,7 @@ abstract class AuthorizationServer { 'Authorization code grants are not supported.', req.query['state'] ?? '', ), - statusCode: 405, + statusCode: 400, ); } @@ -120,7 +120,7 @@ abstract class AuthorizationServer { 'Refreshing authorization tokens is not supported.', req.body['state'] ?? '', ), - statusCode: 405, + statusCode: 400, ); } @@ -138,7 +138,7 @@ abstract class AuthorizationServer { 'Resource owner password credentials grants are not supported.', req.body['state'] ?? '', ), - statusCode: 405, + statusCode: 400, ); } @@ -151,7 +151,7 @@ abstract class AuthorizationServer { 'Client credentials grants are not supported.', req.body['state'] ?? '', ), - statusCode: 405, + statusCode: 400, ); } @@ -319,7 +319,7 @@ abstract class AuthorizationServer { 'Invalid "client_id" parameter.', state, ), - statusCode: 401, + statusCode: 400, ); } @@ -330,7 +330,7 @@ abstract class AuthorizationServer { 'Invalid "client_secret" parameter.', state, ), - statusCode: 401, + statusCode: 400, ); } } diff --git a/pubspec.yaml b/pubspec.yaml index cd10ecde..75ae825a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: angel_oauth2 author: Tobe O description: angel_auth strategy for in-house OAuth2 login. homepage: https://github.com/thosakwe/oauth2_server.git -version: 1.0.0-alpha +version: 1.0.0-alpha+1 environment: sdk: ">=1.19.0" dependencies: diff --git a/test/client_credentials_test.dart b/test/client_credentials_test.dart index 06c074b6..22fa6042 100644 --- a/test/client_credentials_test.dart +++ b/test/client_credentials_test.dart @@ -65,7 +65,7 @@ main() { ); print('Response: ${response.body}'); - expect(response, hasStatus(401)); + expect(response, hasStatus(400)); }); test('force correct secret', () async { @@ -80,7 +80,7 @@ main() { ); print('Response: ${response.body}'); - expect(response, hasStatus(401)); + expect(response, hasStatus(400)); }); }