0

我正在尝试使用 OAuth 2 访问 EWS,但出现错误远程服务器返回错误:(401)未授权

我成功收到了访问/刷新令牌

此处向 ExchangeService 添加令牌

ExchangeService service = new ExchangeService("Exchange2010_SP1");
service.getHttpHeaders().put("Authorization", "Bearer " + "some token");
service.setUrl("_serviceURI");

service.findFolders(WellKnownFolderName.Drafts, new FolderView(Integer.MAX_VALUE));

无处出现错误远程服务器返回错误:(401)未授权

我在这里做错了什么?

以下是我的授权网址

https://login.microsoftonline.com/{tenant id}/oauth2/v2.0/authorize?
client_id=client_id
&response_type=code
&redirect_uri=https://localhost:80800/api/
&response_mode=query
&scope=openid offline_access https://outlook.office365.com/.default 
&state=12345
4

0 回答 0