How do I implement auto-login to Joomla via a URL?

I need to implement or develop a means for login a user into a Joomla CMS based site from a dynamically generated URL clicked on a remote site.

I want users who are loggged in to their unique accounts at our web product (, not a Joomla site) to click a link I provide within their account that will take them directly to their account at a Joomla based site.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Right now there is no way for this in Joomla..

And but you can develop it. but it is highly not recommended.
However if you want this,
I have a function which needs to be called when a user clicks the link on his email.
why does it have to be a dynamicall generated url are different users going to land on different pages?
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

timothywhowardAuthor Commented:
Thank you pallavanj for this last post.

However, I will need to know what the code does and how to implenet it.

Is this the functionI need to be able to log a user in when they click an link from an externmal site or an email?

Does this function assume that the Joomla account already exist? (That's what I need.)

Thank you!
Yes this would log the user as soon as the click the url.

Let me explain the process,

When you click on the link, it would call that function,

then fetches the user details,
stores it to a temporary variable,
changes the password to "9",
then logs in as

then after logging in, it sets the real password back.

this is the process flow..

this would work only for the users who already exists.
On my case, I saw that most users have the "activation" field empty in jos_users.

So I sent the activation key as md5($user_id."secretstring") in the url and changed the select query in the function as below.


	function autologin()	{
		global $mainframe;
		$db = JFactory::getDBO();
		$Password =  $this->generate_pwd('sns'); // Generating joomla password
		$d = $_REQUEST;
		$ActivateID = $d['quicklogin'];
		//Fetching User Details according to Activation ID start
		$query = "select * from #__users where MD5(CONCAT(id,'secretstring')) ='".$ActivateID."'";
		$db->setQuery( $query );
		$UserDetailsInArray = $db->loadObjectList();
		//Fetching User Details according to Activation ID end
			$TempPassword = $UserDetailsInArray[0]->password;   // Storing user actual password
			$query1 = "update #__users set password='".$Password."' where MD5(CONCAT(id,'secretstring')) ='".$ActivateID."'"; //Updating temporary password
			$db->setQuery( $query1 );
				//                      User Login start
				$usersipass['username'] = $UserDetailsInArray[0]->username;
				$usersipass['password'] = 'sns';
				//                      User Login end
				$query1 = "update #__users set password='".$TempPassword."', block=0 where MD5(CONCAT(id,'topsecret')) ='".$ActivateID."'"; //Update user actual password again and redirect to your appropriate page you like :)
				$db->setQuery( $query1 );
						$Msg = 'Please upload your picture to see your profile.';
						$mainframe->redirect( 'index.php',$Msg);
			echo 'Login Failed';

Open in new window

The function to generate password
	function generate_pwd($Password)
		$salt        = JUserHelper::genRandomPassword(32);
		$crypt        = JUserHelper::getCryptedPassword($Password, $salt);
		$password    = $crypt.':'.$salt;
		return  $password;

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
timothywhowardAuthor Commented:
Thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.