问题描述
我是 Aqueduct 的新手,每当我尝试向 /auth/token
或 /auth/code
路由发出请求时,都会遇到无效的客户端错误.我已经添加了 OAuth2.0 客户端并验证了密码是正确的.我对 /auth/token
的请求如下所示:
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);
当我尝试使用 _user 数据库中的用户名登录 /auth/code
时,服务器抛出一个 400:invalid_client
And when I try logging in in /auth/code
with a username in the _user database the server throws a 400:invalid_client
推荐答案
这确实是一个配置错误的问题.删除所有数据库后,我添加了一个 database.yaml 文件,我认为它与 config.yaml 相同,但显然不是.database.yaml 如下所示:
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
虽然 config.yaml 看起来像这样:
while the config.yaml looks like this:
database:
username: adan
password: pass
host: localhost
port: 5432
databaseName: wildfire_db
我还运行了 aqueduct auth
和 aqueduct db
命令而没有 --connect 标志,即使用配置文件.
I also ran the aqueduct auth
and aqueduct db
commands without the --connect flag, i.e. using the config files.
这篇关于渡槽的 db_and_auth/wildfire 示例中的客户端无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!