I try to set up authentication via oauth 2.0 in my aqueduct app. I have followed step by step tutorial at aqueduct.io addjusting it to my app.
Unfortunately I have stuck after creating client at first authentication requests:
POST http://localhost:8888/auth/token -H 'Authorization: Basic dGVzdG5hbWU6dGVzdHBhc3N3b3Jk' -H 'Content-Type: application/x-www-form-urlencoded' -d 'username=testname&password=testpassword&grant_type=password'
If entryPoint looks like:
@override
Controller get entryPoint {
final router = Router();
router
.route('/auth/token')
.link(() => Authorizer.basic(authServer));
//.link(() => AuthController(authServer));
router
.route('/register')
.link(() => RegisterController(context, authServer));
return router;
Then I have got error:
curl: (6) Could not resolve host: Basic
curl: (6) Could not resolve host: dGVzdG5hbWU6dGVzdHBhc3N3b3Jk'
curl: (6) Could not resolve host: application
'password' is not recognized as an internal or external command,
operable program or batch file.
'grant_type' is not recognized as an internal or external command,
operable program or batch file.
And if I change Authorizer.basic to AuthController (according to tutorial):
router
.route('/auth/token')
//.link(() => Authorizer.basic(authServer));
.link(() => AuthController(authServer));
then the same error starts with extra line:
{"error":"invalid_client"}