简体   繁体   English

如何在hybridauth中获取身份验证提供程序?

[英]How to get Auth Provider in hybridauth?

i am using hybridauth to allow my users to sign in to my web site. 我正在使用hybridauth允许我的用户登录我的网站。 i want to know which auth provider (facebook, googel,..) is current user is using. 我想知道当前用户正在使用哪个身份验证提供程序(facebook,googel等)。 in this case i am using below script. 在这种情况下,我正在使用以下脚本。 but it did not get the auth provider. 但它没有获得身份验证提供程序。 how to do this. 这个怎么做。 give me some hints? 给我一些提示吗?

<?php

session_start();

$config = dirname(__FILE__) . '/hybridauth/config.php';
require_once('hybridauth/Hybrid/Auth.php');

$ha = new Hybrid_Auth($config);

$t = $ha->authenticate('Facebook');

if ($t->isUserConnected()) {

    $profile = $t->getUserProfile();
?>

<html>
<body>
<pre><?php echo print_r ($profile); }?></pre>
</body>
</html> 

Have you tried Hybrid_Auth::getConnectedProviders()? 您是否尝试过Hybrid_Auth :: getConnectedProviders()?

You could also pass-in a particular provider to check to see if a specific one is connected: Hybrid_Auth::isConnectedWith(provider) 您还可以传递一个特定的提供程序来检查是否连接了特定的提供程序:Hybrid_Auth :: isConnectedWith(provider)

Check the API doc for more info. 查看API文档以获取更多信息。

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

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