Full authentication is required to access this resource的两种解决办法

问题:用httpclient做数据上传时报错:Full authentication is required to access this resource

1、用postman测试解决问题,如下图所示添加Bearer Token后添加成功:

token的获取方法:1、通过获取token的接口获取;2、从登录返回的结果中获取

Full authentication is required to access this resource的两种解决办法_第1张图片

2、使用HttpClient添加header,入图中所示(/code/main/test/util/HttpTestUtils.java):

post.addHeader("Authorization", "Bearer " + "BaseJwtToken80023F7F3F92DCF66807EB95AA8E0368BC1965542B72258DEF1F8DA556C3323FFF64D94C23ECAD9E621633A6AA887DB4AD11");

Full authentication is required to access this resource的两种解决办法_第2张图片

你可能感兴趣的:(Java,java,servlet,开发语言)