How to set requiredAttributes and optionalAttributes in OpenID?

I wrote codes as below, it brings me to the OpenID login page, but after I logged in, it didnt show any information, how can I set the requiredAttributes and optionalAttributes?

This is my Default controller :




    use yii\authclient\MyAuthClient;


    public function actionAuth(){

		$client = new MyAuthClient();		

		$url = $client->buildAuthUrl(); // Get authentication URL

		$client->requiredAttributes = ['nickname'];

		$client->optionalAttributes = ['email', 'fullname'];

		

		return \Yii::$app->getResponse()->redirect($url); // Redirect to authentication URL

				

		if ($client->validate()) { // validate response

		    $userAttributes = $client->getUserAttributes(); // get account info

		    

		

		}

	}



This is my MyAuthClient.php :




    namespace yii\authclient;


    use yii\authclient\OpenId;

    use yii\helpers\Url;


    class MyAuthClient extends OpenId

    {

	    public $authUrl = 'https://openid.mydomainname'; // Setup provider endpoint

	    public $requiredAttributes = [

 		    'nickname',

 	    ];

 

 	    public $optionalAttributes = [

 		    'email',

 		    'fullname',

 	    ];

	

	

    }




May someone advise me am I do something wrong here?

And how can I set the url to be redirected after logout?

Thanks.