Jmeter Oauth2访问令牌请求失败,响应代码为401

时间:2020-03-14 10:40:19

标签: oauth-2.0 jmeter authorization performance-testing

长话短说,我试图获取访客的令牌,但收到401响应代码,但我不确定,我在做什么错。

HTTP Request

enter image description here JSR223预处理程序代码:

import org.apache.commons.codec.binary.Base64;

byte[] encodedUsernamePassword = Base64.encodeBase64("user_pass".getBytes());
vars.put("auth",new String(encodedUsernamePassword));

enter image description here

enter image description here

响应数据:

Response code:401
Response message:Unauthorized

索取文件 enter image description here

1 个答案:

答案 0 :(得分:0)

我发现问题出在哪里:我必须将Grant_type作为参数发送而没有范围 enter image description here

相关问题