簡體   English   中英

Podio PHP API中的多重身份驗證

[英]Multiple authentication in podio php api

我已經使用podio php API創建了一個應用程序。 登錄的用戶將使用其刷新令牌進行身份驗證。

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

在某些情況下,我需要將用戶詳細信息添加到podio的另一個應用程序中。 登錄的用戶無權訪問該應用。 這將導致Podio Forbidden錯誤。

僅應用程序的管理員對此應用程序擁有正確的權限。

我們如何驗證用戶的身份以便在應用程序中插入其詳細信息?

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM