Probably A Simple Programing Question

I want to change the "successUrl" configures in the function actions from within the function authenticate.

Here is part of the code


<?php

use yii\web\Controller;

use yii\filters\AccessControl;

use yii\filters\VerbFilter;

use yii\authclient\ClientInterface;


class SecurityController extends Controller

{

   


    /**

     * @inheritdoc

     */

    public function actions()

    {

        return [

            'auth' => [

                'class' => 'yii\authclient\AuthAction',

                'successCallback' => [$this, 'authenticate'],

                'successUrl' => 'http://www.google.com'  // I WANT TO CHANGE THIS FROM WITHIN authemticate


            ]

        ];

    }


   


    /**

     * Logs the user in if this social account has been already used. Otherwise shows registration form.

     *

     * @param  ClientInterface $client

     * @return \yii\web\Response

     */

    public function authenticate(ClientInterface $client)

    {

        $attributes = $client->getUserAttributes();

        $provider   = $client->getId();

        $clientId   = $attributes['id'];


        if (null === ($account = $this->module->manager->findAccount($provider, $clientId))) {

            $account = $this->module->manager->createAccount([

                'provider'   => $provider,

                'client_id'  => $clientId,

                'attributes' => json_encode($attributes)

            ]);

            $account->save(false);

        }


        if (null === ($user = $account->user)) {

            //SET successUrl to ['/user/registration/connect', 'account_id' => $account->id]

          

        } else {

            \Yii::$app->user->login($user, $this->module->rememberFor);

            //SET successURL to other link

            

        }

    }

}

Who can I access to successUrl fron authenticate? I think this should be simple, but I have something to learn about php :confused: