Invalid client in aqueduct's db_and_auth/wildfire example

笑着哭i 提交于 2019-12-24 07:16:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!