问题描述
我正在尝试调用 api 来获取 keycloack 令牌。 问题是 api 需要数据作为 URLSearchParams(); 唯一的问题是我无法使用相同的类型传递这些数据。我必须将其转换为字符串。并且 api 不接受它。我该如何走动。使用数据不起作用,参数字段也不起作用
const content = new URLSearchParams();
content.append('grant_type','password');
content.append('scope','openid');
content.append('client_id',clientId);
content.append('client_secret',clientSecret);
content.append('username',username);
content.append('password',password);
const res = await this.http.post(url,{
data: content,content: content.toString(),params: {
grant_type: 'password',},headers: { 'application-type': 'application/x-www-form-urlencoded' },});
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)