PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, December 30, 2021

[FIXED] How can I get access to user identity after callback in Yii2

 December 30, 2021     php, yii, yii2     No comments   

Issue

in my controller I have this below behaviour function:

public function behaviors()
{
    return [
        'verbs' => [
            'class' => \yii\filters\VerbFilter::className(),
            'actions' => [
                'verifym'  => ['OPTIONS','POST','GET']
            ]
        ],
        'access' => [
            'class' => \yii\filters\AccessControl::className(),
            'rules' => [
                [
                    'allow' => true,
                    'actions' => [
                        'index', 'payment', 'result', 'verify',
                        'paymentvalidation'
                    ],
                    'roles' => [ 'user' ]
                ],
                [
                    'allow' => true,
                    'actions' => ['verifym'],
                    'roles' => ['*']
                ]
            ],
            'denyCallback' => function ($rule, $action) {
                $this->redirect([ '/' ]);
                return null;
            }
        ]
    ];
}

When from outside referrer calls verifym action it not fires, and denyCallBack fires. And user identity is null.
Why denyCallBack is fire and what change needs in my access rule for this?
Why user identity is null and How can access to that in callback process?


Why after callback from other different domain, user identity and sessions is null and with a refresh it take values?

Can anyone help me?


Solution

It seems after calling back my url from other specific domain, it's blocked their headers in request and Yii framework identity checks some headers by reading them from request's header. So I configured it by send and get some parameters between request and response.



Answered By - parsa
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing