We are developing an API, and I have been tasked with integrating a frontend web application using our API into our developer portal. Our portal is provided by a commercial API management system, so we cannot run anything directly on their servers. The application is hosted, like our API, on EC2, but the app itself can be straightforwardly embedded in the portal using an iframe.
All of our api keys, usernames and passwords are managed for us on the portal - we don't have to worry about any of that (which is precisely why we went with that solution, rather than building a portal ourselves). But the application is backed by a mysql database which, since it lives on EC2, doesn't have any direct access to portal user credentials.
The EC2 server domain is of the form api.example.com, and the portal is of the form developer.example.com. So they are both CNAME subdomains of our main domain, example.com, and using a simple JS hack I can make ajax requests to send api keys and other user credentials (over HTTPS) to the api server. The real question I'm wrestling with is how to integrate database users and their associated resources (sessions, tables, etc.) with the portal. The more I consider it the more difficult the task seems to appear... and I don't believe I'm over-thinking it... though I'm certainly no mysql guru, so I might well be overlooking something mysql-related which could help. Two main questions arise in my mind:
How do I manage database users? Most likely I would want one db user per API account, which would be easy to manage if our sign-up process also registered a database user... but since our database is entirely separate from the portal, and we don't have access to the login process itself, that would seem hard to integrate.
How can sessions be effectively managed? This is an easy task for a standalone application, but for an embedded application which can't directly access or manage the login/logout process it would seem much harder.
If anyone has any suggestions or examples for tackling this I would be immensely grateful.