问题
I am new to Aqueduct and I am facing a invalid client error whenever I try to make a request to the /auth/token
or /auth/code
route.
I have already added the OAuth2.0 client and verified the secret is correct.
My request to /auth/token
looks like this:
Future main() async {
var http2 = new http.Client();
var clientID = "com.wildfire.mobile";
var clientSecret = "myspecialsecret ";
var body = "username=usr&password=pwd&grant_type=password";
var clientCredentials = new Base64Encoder().convert(
"$clientID:$clientSecret".codeUnits);
var response = await
http.post(
"http://localhost:8081/auth/token",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Basic $clientCredentials"
},
body: body);
And when I try logging in in /auth/code
with a username in the _user database the server throws a 400:invalid_client
回答1:
It was indeed a misconfiguration issue. After deleting all my databases, I added a database.yaml file, which I thought was the same as the config.yaml but apparently is not. The database.yaml looks like this:
username: adan
password: pass
host: localhost
port: 5432
databaseName: wildfire_db
while the config.yaml looks like this:
database:
username: adan
password: pass
host: localhost
port: 5432
databaseName: wildfire_db
I also ran the aqueduct auth
and aqueduct db
commands without the --connect flag, i.e. using the config files.
来源:https://stackoverflow.com/questions/45809125/invalid-client-in-aqueducts-db-and-auth-wildfire-example