简体   繁体   English

Podio PHP API中的多重身份验证

[英]Multiple authentication in podio php api

I have created an app using the podio php api. 我已经使用podio php API创建了一个应用程序。 The logged user will authenticate with his refresh token. 登录的用户将使用其刷新令牌进行身份验证。

Podio::authenticate('refresh_token', array('refresh_token' => USER_REFRESH_TOKEN )); Podio :: authenticate('refresh_token',array('refresh_token'=> USER_REFRESH_TOKEN));

In some cases, I need to add the user details in to another app in podio. 在某些情况下,我需要将用户详细信息添加到podio的另一个应用程序中。 The logged user doesn't have the permission to access that app. 登录的用户无权访问该应用。 This will cause a Podio Forbidden error. 这将导致Podio Forbidden错误。

Only the admin of the app have the right permission for this app. 仅应用程序的管理员对此应用程序拥有正确的权限。

How can we authenticate the user for inserting his details in the app? 我们如何验证用户的身份以便在应用程序中插入其详细信息?

The oauth tokens are stored in Podio::$oauth so you can switch that around whenever you want to authenticate as a different entity. oauth令牌存储在Podio::$oauth因此您可以在每次要身份验证为其他实体时进行切换。

For example if you want to switch between two different apps: 例如,如果要在两个不同的应用程序之间切换:

// Authenticate as the first app
Podio::authenticate('app', ...);

// Here you can make API requests as the first app

// When you want to switch, store the current auth before doing your second auth
$first_app_auth = Podio::$oauth;

// Auth as the second app.
Podio::authenticate('app', ...);

// Now you can make API requests as the second app

// ...and switch back to the first app
$second_app_auth = Podio::$oauth;

// Auth as the first app again:
Podio::$oauth = $first_app_auth;

// Make API requests as the first app again

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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