我想在Java中使用restapi并继续收到错误401.
如果我删除了webapi中的授权,我没有任何问题,只是在启用授权并且我必须在标题中传递令牌时才会出现问题。我需要在标题
中传递令牌这就是我所拥有的
public getRestTest() throws IOException{
final List<Object> providers = new ArrayList<>();
providers.add(new JacksonJaxbJsonProvider());
WebClient client = WebClient.create("http://resturl/api/controller/", providers);
String token = Authenticate(); //I get the Authorization token as string in here
client.header("Token", token);
Response response = client.get(); //error 401 in here
return null;
}