# Plugin authentication 1.1

**URL:** <https://discourse.cakephp.org/t/plugin-authentication-1-1/6092>\
**Category:** Plugins\
**Created:** [May 16, 2019, 2:27pm UTC](https://discourse.cakephp.org/t/plugin-authentication-1-1/6092 "2019-05-16T14:27:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![farid](https://avatars.discourse-cdn.com/v4/letter/f/ecb155/32.png) [@farid](https://discourse.cakephp.org/u/farid)\
**Post date:** [May 16, 2019, 2:27pm UTC](https://discourse.cakephp.org/t/plugin-authentication-1-1/6092/1 "2019-05-16T14:27:35Z")

</div>

how to redirect user after login  
here my code but not working with login

here my Authentication Componen

> $this-\>loadComponent(‘Authentication.Authentication’, [  
> ‘loginRedirect’ =\> ‘/web/user/siteuser’,  
> ‘logoutRedirect’ =\> ‘/user/login’, // Default is false  
> ‘unauthenticatedRedirect’ =\> [  
> ‘Plugin’ =\> false,  
> ‘prefix’ =\> false,  
> ‘controller’ =\> ‘user’,  
> ‘action’ =\> ‘login’  
> ]  
> ]);

HereMy Login Action

> ```
> $result = $this->Authentication->getResult();
> debug($result);
> // regardless of POST or GET, redirect if user is logged in
> if ($result->isValid()) {
> $redirect = $this->request->getQuery('redirect', [
> 'plugin' => 'CoreDev',
> 'Prefix' => 'User',
> 'controller' => 'Siteuser',
> 'action' => 'index'
> ]);
> return $this->redirect($redirect);
> }
> 
> ```
