Following problem.
I have a website:
example.com
but there are some side websites lets say:
data.example.comhelp.example.com
They are all run by the same flask application. Now I want the user be able to click login on any of those websites and be logged in on all of them. Right now there are two post requests available at:
example.com/api/loginexample.com/api/logout
Now the issue is, when logging in from example.com everything works beautifully. I am even logged in on the subdomains themselves. Thank you Mozilla. But when logging in from one of the other subdomains I get a failure response due to domain mismatch, which makes perfect sense to me since its a security risk.
I know of two solutions:
- When on the subdomain redirect to the real domain first and have the user click login again.
- Create
/api/loginand/api/logout urlsfor every subdomain itself. Problem here is user needs to logout at the url he logged in
Of course method 2 would be better for the user.
Now the real question is there any way to login from these subdomains without login/logout urls for each domain?
Let me know if I need to clarify. Thanks in Advance.