I need to integrate a Joomla website with a third party REST API. Let me try to clarify what I'm trying to do. Ideally when a user logs on to the Joomla website once they authenticate they will also be able to access another website, likely via a link on the Joomla site without having to login to this other site again. There is a REST API for this other site that has various login methods such as a single user sign on, and that is what I'm thinking is what I would need to make a call to.
I'm figuring it would work something like this:
User logs into the Joomla site, the user is authenticated by Joomla. Now once the user is authenticated by Joomla system, go call the REST API and authenticate with it, if authentication was good, store the proper information received back from the API, like the AUTH TOKEN and anything else required for login to other site, in perhaps the session variables or on the clients machine in a cookie to used when trying to access the other site. I'm not sure what is the correct way to make this work and any insight into how this is done in theory or in practice would be great. I have been looking for information but only seem to find a lot of people discussing how to have a REST API for your Joomla website and not a whole lot on how to connect to an external REST API from a Joomla site.
Upon my searching for the proper way to go about this I assume it lies in either creating a plugin like the standard Joomla user authentication plugin and adding this functionality into it or creating a plugin that listens for the proper event. If I need to actually create a plugin that listens to events, I'm not sure yet if I need to listen for the onUserAuthenicate response or onUserLogin event. But I have a good feeling it is one of the two. I have some idea of how to use the curl library to talk to the API so I figure this how I would attempt it.
Any insight, examples or direction on how to do this would greatly be appreciated! Thanks!