Introduction
Authentication library exposes a mimeeqAuth
object accessible globally via window
.
This library exposes various methods that can be used to integrate your website with Mimeeq Authentication in many ways.
Please make sure to have mmq-auth
element added to your site. None of the methods will work without it. You can find required snippet under Admin Panel -> Settings -> Login Code (button).
Authentication URL
If you would like to have direct authentication URL that opens login modal automatically, use following:
https://your-domain.com/?auth=mimeeq
Our authentication logic will handle session state, and according to whether user is logged in or not will display login form or logout prompt.
You can also display login/logout modal programatically, simply adding <a href="?auth=mimeeq">Login</a>
link to the page. State of the modal will be handled automatically.
Interacting with mimeeqAuth API
Library loads asynchronously which means that mimeeqAuth
object is not available immediately after page load.
To make sure library is loaded when you use it, you need to listen for mimeeq-auth-loaded
event, for example:
document.addEventListener('mimeeq-auth-loaded', () => {
mimeeqAuth.authorization.signOut().then(() => {
window.location.reload();
});
});