We have an external login system which creates set of cookies. My joomla site and external site (which is responsible to login a user) are on the same domain so I can access the cookies being set by external site. I want to login user automatically using those cookies in Joomla if user exists and if user doesn't exists, I want to create a user and log them in automatically.

Can someone please point me in a right direction what plugin to use so that it is a seamless experience to a user and user will never realize that they are being authenticated in some other system and logged in automatically?

If someone has done it before, and post the code snippet, that will be very helpful so that I don't have to re-invent the wheel


1 Answer 1


You have to create an "authentication" plugin to read cookies and auto-login the user.

You can simply duplicate and modify any of the "authentication" plugins.

Ref: Creating an Authentication Plugin for Joomla

  • Well, onAuthenticate will not trigger on page load. Will it? As I mentioned, user logged in to some other part of my domain. So I will have to start from cookies as soon as they land on my joomla site Commented Feb 26, 2016 at 16:03
  • 1
    You have to follow the regular login workflow... though you can customize the login form to auto-submit in the first visit to trigger onAuthenticate. If it works Ok, you can proceed. Otherwise, you should follow with the rest of auth plugins and in the worst case return and show the standard login form.
    – Anibal
    Commented Feb 26, 2016 at 19:50
  • 2
    Anibal's answer is halfway there. You need 2 plugins, authentication and system. The most appropriate plugin to fork (base your work on) would be the Cookie Authentication (formerly: Remember Me) plugin found under plugins/authentication/cookie. You only need to implement the onUserAuthenticate method in your plugin. You will also need to use a system plugin, just like the plugins/system/remember plugin to apply the authentication onAfterInitialise.
    – nikosdion
    Commented Apr 28, 2018 at 12:36
  • Hi, Can you provide the sample code this.
    – Raj Mohan
    Commented Jul 17, 2019 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.