I hope you can help me with this to find a solution.
On site1 I have a Joomla 3.x installation. I want to run an external script which validates a user on site2 (this is already working).
After getting a positive response from site2, I get the username passed back to the Joomla site1 script (or if needed a second script on site1).
Now what I need to do is to check on site1 if this username exist in the Joomla DB. If true then the user should get logged in into Joomla and redirected to a URL. If not the user should be created in Joomla with a random password and then logged in, too.
I tried the authentication plugin tutorial, but this did not help me. Also I tried this script, but it did not work too: https://gist.github.com/AdamMadrzejewski/020c4fa4b1d0e7af78b8
Any ideas how to log in a user into Joomla from an external script?