我是 Aqueduct 的新手,每当我尝试向/auth/token
or/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);
当我尝试/auth/code
使用 _user 数据库中的用户名登录时,服务器会抛出一个400:invalid_client