yii2-authclient
yii2-authclient copied to clipboard
Oauth2 state wrappers
Q | A |
---|---|
Is bugfix? | no |
New feature? | yes |
Breaks BC? | no |
Tests pass? | yes |
usage example
<?php
namespace app\components\oauth;
use Yii;
use yii\authclient\clients\Live AS baseLive;
class Live extends baseLive
{
/**
* Composes user authorization URL.
* @param array $params additional auth GET params.
* @return string authorization URL.
*/
public function buildAuthUrl(array $params = [])
{
if ($clientId = Yii::$app->request->get('sysClient')) {
$this->addToOauthState('sysClient', $clientId);
}
return parent::buildAuthUrl($params);
}
}
<?php
namespace app\components;
use Yii;
use yii\authclient\ClientInterface;
/**
* OAuthHandler handles successful authentication via Yii auth component
*/
class OAuthHandler
{
private $client;
private $oauthState;
public function __construct(ClientInterface $client)
{
$this->client = $client;
$this->oauthState = $client->oauthState;
}
(...)
Thank you for putting effort in the improvement of the Yii framework. We have reviewed your pull request.
In order for the framework and your solution to remain stable in the future, we have a unit test requirement in place. Therefore we can only accept your pull request if it is covered by unit tests.
Could you add these please?
Thanks!
P.S. If you have any questions about the creation of unit tests? Don't hesitate to ask for support. More information about unit tests
This is an automated comment, triggered by adding the label pr:request for unit tests
.