0

I'm currently working on an integration between Podio and another API, and i've stumbled on the following situation:

I currently have to find information from a reference in one workspace in an app containing information about invoices and then locate the specific customer in the other workspace in an app containing that information.

I used to be able to just authenticate myself with more than one app at a time, and then dynamically get information from references to other apps. But right now I have to follow the following code flow to not get exceptions:

  1. I have to first Authenticate myself with the Invoices app
  2. Fetch the PodioObjects I need
  3. Run through the items one by one, each time Authenticate myself with the Customer app so I can fetch their information and then again Authenticate myself with the Invoice app

That means a ton of requests to Podio, which I shouldn't need.

$authenticateCustomers = Podio::authenticate_with_app(*, '*');
$customer = PodioItem::get($itemId);
$name = $customer->fields['companies']->values;
$authenticateSales = Podio::authenticate_with_app(*, '*');

Before the above snippet I've already Authenticated with them in my constructor.

If I remove the authentications, I get Exceptions due to not being Authenticated.

Advice? Thanks in advance.

Pavlo - Podio
  • 2,003
  • 2
  • 10
  • 19
  • can you share bit more code? (to include part when you are authenticating in constructor). Also, if you can name all apps that you need to work with, and define what is 'end-goal' of your program that would help :) – Pavlo - Podio Sep 28 '16 at 17:47
  • also, can you elaborate why you can't be authenticated as yourself anymore? (question is raising from your words `I used to be able to just authenticate myself with more than one app at a time, and then dynamically get information from references to other apps.`) – Pavlo - Podio Oct 03 '16 at 17:58

1 Answers1

0

Why not use Username/password authentication?

That way you only have to authenticate once, and you have access to all spaces/apps you're admin in. This is more suitable for these types of dynamic workflows across apps.

//Authenticate podio with $username and $password.
Podio::authenticate_with_password($username, $password);

//Get first item
$firstItem = PodioItem::get($itemId);

//Get second item
$secondItem = PodioItem::get($secondItemId);
Kjaal
  • 57
  • 8