0

我已经使用 podio php api 创建了一个应用程序。登录的用户将使用他的刷新令牌进行身份验证。

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

在某些情况下,我需要将用户详细信息添加到 podio 中的另一个应用程序中。登录的用户无权访问该应用程序。这将导致 Podio Forbidden 错误。

只有该应用的管理员拥有此应用的正确权限。

我们如何验证用户在应用程序中插入他的详细信息?

4

1 回答 1

0

oauth 令牌存储在其中,Podio::$oauth因此您可以在想要作为不同实体进行身份验证时切换它。

例如,如果您想在两个不同的应用程序之间切换:

// 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
于 2014-07-01T17:32:30.907 回答