I'm developing an app which uses the data from podio website. Here my need is that Integrate the Podio api into my app and Authenticate the app with user credentials.
How this could be done?? please put some example codes. <<<THANKS IN ADVANCE>>>>>
I'm developing an app which uses the data from podio website. Here my need is that Integrate the Podio api into my app and Authenticate the app with user credentials.
How this could be done?? please put some example codes. <<<THANKS IN ADVANCE>>>>>
Podio has a well maintained/detailed API documentation.
Podio supports four different ways of authenticating depending on what kind of application you are building:
You could get the auth structure and sample codes here.
For authenticating with the application I wrote this code in Angular JS. It connects and authenticates with the API very well.
function apiService($http,$q){
var authEndPoint = 'https://podio.com/oauth/token?'
var contactFormEndpoint = 'https://api.podio.com/item/app/'
let YOUR_APP_ID = '*****';
let YOUR_PODIO_APP_ID = '******';
let YOUR_URL = 'http://localhost:9001';
let YOUR_APP_SECRET = '*******';
let YOUR_PODIO_APP_TOKEN = '**********';
let params = 'grant_type=app&app_id=' + YOUR_PODIO_APP_ID + '&app_token='
YOUR_PODIO_APP_TOKEN + '&client_id=' + YOUR_APP_ID + '&redirect_uri=' +
YOUR_URL + '&client_secret=' + YOUR_APP_SECRET;
let access_token;
var options =
{
"external_id": "itemID",
"fields": "fields",
};
var payload =
{
"name": "Mohammad",
"email": "test@dis.com",
"your-message": "test",
"options":options
};
payload = JSON.stringify(payload);
// Promise-based API
return {
auth : function() {
return $http.post(authEndPoint + params, {
cache: false,
}).then(function successCallback(response) {
access_token = response.data.access_token;
console.log("access t", access_token);
// let refresh_token = response.data.refresh_token;
// let token_type = response.data.token_type;
// let scope = response.data.scope;
}, function errorCallback(response) {
return access_token;
});
},
sendContactDetails: function () {
return $http.post(
contactFormEndpoint + '******'+'/' ,payload, {
headers: {
'Authorization': 'oauth_token' + access_token
},
}).then(function successCallback(response) {
console.log("sucess" + response);
},
function errorCallback(response) {
console.log("failed" + response);
})
}