Oauth 2.0 渡槽中的无效客户端';s db_和_auth/wildfire示例

Oauth 2.0 渡槽中的无效客户端';s db_和_auth/wildfire示例,oauth-2.0,dart,aqueduct,Oauth 2.0,Dart,Aqueduct,我是一名新用户,每当我尝试向/auth/token或/auth/code路由发出请求时,我都会遇到无效的客户端错误。 我已经添加了OAuth2.0客户端,并验证了密码是否正确。 我对/auth/token的请求如下所示: Future main() async { var http2 = new http.Client(); var clientID = "com.wildfire.mobile"; var clientSecret = "myspecialsecret "; v

我是一名新用户,每当我尝试向
/auth/token
/auth/code
路由发出请求时,我都会遇到无效的客户端错误。 我已经添加了OAuth2.0客户端,并验证了密码是否正确。 我对
/auth/token
的请求如下所示:

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);
 username: adan
 password: pass
 host: localhost
 port: 5432
 databaseName: wildfire_db
database:
 username: adan
 password: pass
 host: localhost
 port: 5432
 databaseName: wildfire_db

当我尝试使用用户数据库中的用户名登录
/auth/code
时,服务器抛出一个
400:invalid\u client

,这确实是一个配置错误的问题。删除所有数据库后,我添加了一个database.yaml文件,我认为它与config.yaml相同,但显然不是。 database.yaml如下所示:

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);
 username: adan
 password: pass
 host: localhost
 port: 5432
 databaseName: wildfire_db
database:
 username: adan
 password: pass
 host: localhost
 port: 5432
 databaseName: wildfire_db
虽然config.yaml如下所示:

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);
 username: adan
 password: pass
 host: localhost
 port: 5432
 databaseName: wildfire_db
database:
 username: adan
 password: pass
 host: localhost
 port: 5432
 databaseName: wildfire_db

我还运行了
导水管auth
导水管db
命令,但没有--connect标志,即使用配置文件。

这确实是一个配置错误的问题。删除所有数据库后,我添加了一个database.yaml文件,我认为它与config.yaml相同,但显然不是。 database.yaml如下所示:

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);
 username: adan
 password: pass
 host: localhost
 port: 5432
 databaseName: wildfire_db
database:
 username: adan
 password: pass
 host: localhost
 port: 5432
 databaseName: wildfire_db
虽然config.yaml如下所示:

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);
 username: adan
 password: pass
 host: localhost
 port: 5432
 databaseName: wildfire_db
database:
 username: adan
 password: pass
 host: localhost
 port: 5432
 databaseName: wildfire_db

我也在没有--connect标志的情况下运行了
aqueduct auth
aqueduct db
命令,即使用配置文件。

需要检查几件事:您的配置文件指向正确的数据库吗?您是否通过aqueduct auth CLI添加了客户端ID和密码?此外,这里还有一个用于渡槽的松弛通道:需要检查两件事:您的配置文件是否指向正确的数据库?您是否通过aqueduct auth CLI添加了客户端ID和密码?此外,这里还有一条用于渡槽的松弛通道:很高兴听到它起作用了。为了澄清,config.yaml是应用程序配置文件的默认名称。它可能包含零个、一个或多个数据库凭据,并且它们可能是顶级、嵌套等。连接到数据库的CLI命令使用--connect选项提供数据库凭据。为了方便起见,可以将这些凭据放在database.yaml文件中,以避免在CLI中键入它们。但是CLI无法理解应用程序配置文件的细节。很高兴听到它起作用了。为了澄清,config.yaml是应用程序配置文件的默认名称。它可能包含零个、一个或多个数据库凭据,并且它们可能是顶级、嵌套等。连接到数据库的CLI命令使用--connect选项提供数据库凭据。为了方便起见,可以将这些凭据放在database.yaml文件中,以避免在CLI中键入它们。不过,CLI无法理解应用程序配置文件的细节。