Podio Integratioon

时间:2016-07-11 20:01:20

标签: authentication integration podio

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

2 个答案:

答案 0 :(得分:1)

Podio维护得很好/详细API documentation

Podio支持四种不同的身份验证方式,具体取决于您正在构建的应用程序类型:

您可以获取身份验证结构和示例代码here

答案 1 :(得分:0)

为了使用应用程序进行身份验证,我在Angular JS中编写了此代码。它非常好地连接和验证API。

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

    })

  }