java - How to use the access_token to get contents of my App -


i need access podio app using access_token instead of being using username , password. code tried using username , password , working finr me. i'm using

 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); 

but need use accesstoken may not dependent on username , password accessing app. tried using

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"); 

and i'm getting response in form of json like

{ accesstoken: "ae566736ffdb414ab23320c9d169d8a" tokentype: "bearer" ref: { type: "app" id: 88069 }- expiresin: 98800 refreshtoken: "96bbfb0dd9e74ac6ad456f44896c4d3e" } 

which 200 response. took of using https://github.com/podio/podio-java/tree/master/src/main/java/com/podio no use. refer https://developers.podio.com/authentication no . , how can use access_token in java code?

first of all, never post application id , secrets on such websites.

you can use json-parsing library information, example, simplest example gson following:

public class authinfo {     private string accesstoken, tokentype, ...      public string getaccesstoken() {         return accesstoken;     } }  // ...  gson gson = new gson(); string accesstoken = gson.fromjson(response, authinfo.class).getaccesstoken(); 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -