我需要使用 access_token 访问我的播音应用程序,而不是使用用户名和密码。我尝试使用用户名和密码的代码及其对我的工作 finr。我在用着
ResourceFactory resourceFactory = new ResourceFactory(
new OAuthClientCredentials("usedClientId","usedClientSecret"),
new OAuthUsernameCredentials("abc@ggtd.com","Test123"));
APIFactory apiFactory = new APIFactory(resourceFactory);
ItemAPI itemAPI = apiFactory.getAPI(ItemAPI.class);
但我需要使用 accesstoken,这样我就可以不依赖用户名和密码来访问应用程序。为此,我尝试使用
URL url = new URL("https://podio.com/oauth/token?granttype=app&appid=88069&apptoken=6a83845c6656ff4678a5eec668a10aa3e7&clientid=usedClientId-79unji&redirecturi=https://podio.com/abcd/workappname/apps/usedClient&client_secret=jIfs6qWsQJJ99eDDds1RMhmbKywAhsMtTYLFW8GVeFmmeAiCYOOdzDyc3yqdHBT");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Accept", "application/json");
我得到了 JSON 形式的响应,比如
{
accesstoken: "ae566736ffdb414ab23320c9d169d8a"
tokentype: "bearer"
ref: {
type: "app"
id: 88069
}-
expiresin: 98800
refreshtoken: "96bbfb0dd9e74ac6ad456f44896c4d3e"
}
这是 200 响应。我帮助使用了https://github.com/podio/podio-java/tree/master/src/main/java/com/podio但没有用。另请参阅https://developers.podio.com/authentication也没有帮助。现在,我如何在我的 java 代码中使用这个 access_token?