Changes
Title
unchanged
Integrating HybridAuth directly into Yii without an extension
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
Authentication, HybridAuth
Content
changed
[...]
<a href="login.php?provider=google"><img src="images/buttons/google.png" /></a>
<br/>
<a href="login.php?provider=facebook" ><img src="images/buttons/facebook.png" /></a>
<br/>
<a href="login.php?provider=linkedin"><img src="images/buttons/linkedin.png" /></a>
<br/>
<a href="login.php?provider=yahoo"><img src="images/buttons/yahoo.png" /></a>
<br/>
<a href="login.php?provider=live"><img src="images/buttons/live.png" /></a>
</div>
~~~[...]
public $userProfile;
public $allowedProviders = array('google', 'facebook', 'linkedin', 'yahoo', 'live',);
protected $config;[...]
"enabled" => true,
"keys" => array(
"id" => "google client id",
"secret" => "
keygoogle secret",
),
"scope" => "https://www.googleapis.com/auth/userinfo.profile " . "https://www.googleapis.com/auth/userinfo.email",[...]
"enabled" => true,
"keys" => array (
"id" => "facebook client id",
"secret" => "
key",
),
"scope" => "email"facebook secret",
),
"scope" => "email"
),
"Live" => array (
"enabled" => true,
"keys" => array (
"id" => "windows client id",
"secret" => "Windows Live secret",
),
"scope" => "email"
),
"Yahoo" => array(
"enabled" => true,
"keys" => array (
"key" => "yahoo client id",
"secret" => "yahoo secret",
),
),
"LinkedIn" => array(
"enabled" => true,
"keys" => array (
"key" => "
keylinkedin client id",
"secret" => "
linkedin secret",
),
),[...]
The '$allowedProviders' property is used for validation purpose.
**Note:** For Google/Facebook/Live, your client id is represent by the **id** parameter within the *keys* subarray, but for LinkedIn and Yahoo, the same is represented by **key** parameter
For Yahoo, if the above do not work, try including your application id in the configuration:
```php
"Yahoo" => array(
"enabled" => true,
"keys" => array (
"id" => "your yahoo application id", //the additional parameter
"key" => "yahoo consumer id",
"secret" => "yahoo secret",
),
),
```
SiteController actions
----------------------[...]
2. https://mysite.com/site/socialLogin?hauth.done=Facebook
3. https://mysite.com/site/socialLogin?hauth.done=LinkedIn
4. https://mysite.com/site/socialLogin?hauth.done=Yahoo
5. https://mysite.com/ **- for Windows Live** (just the full domain name is enough. Live does not accept query string in its redirect URL)
Note: With this setup process, the install method mentioned in the HybridAuth documentation need not be executed. But remember to delete the install.php file (with or without executing it).
Logging into the Yii Authentication Framework
---------------------------------------------[...]