简体   繁体   中英

How to authenticate as an User in Podio using NodeJS

I'm working on an integration between Slack and Podio. Up until now I've been authenticating as an APP in order to make some API calls. Now I find myself trying to use the Views API but I'm getting the following error message:

message: { error_parameters: {},
   error_detail: null,
   error_propagate: false,
   request: 
    { url: '<api url>',
      query_string: '',
      method: 'POST' },
   error_description: 'Authentication as app is not allowed for this method',
   error: 'forbidden' },
status: 403,
url: '<app url>',
name: 'PodioForbiddenError' }

The error_description makes me think that I need to authenticate as an user, in order to get the access to this API. This is how I'm authenticating right now:

const Podio = require('podio-js').api;
const podio = new Podio({
  authType: 'app',
  clientId: process.env.clientId,
  clientSecret: process.env.clientSecret
});

I haven't been able to find an example of user authentication using node.js/javascript. Do I need to generate a new clientId and/or clientSecret? Can anyone provide a working example?

Thanks for your time!

To authenticate with app you need to provide the app id and app token. By providing client id and client secret you can get the podio client, then you need to authenticate the podio client with app credentials. like

 podio.AuthenticateWithApp(appId, appToken);

you can get appid and app token from the developer tab of the app.

我最终使用podio.AuthenticateWithCredentials(userName, password);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM