By calling MC.login(); the JavaScript SDK will attempt to trigger the authentication dialog.

Depending on where you are, the JavaScript SDK will trigger one of two things. If a game is being hosted on it will trigger a lightbox modal, if the game is being hosted off of it will trigger a popup window dialog.

Please be aware that when being hosted off of your game may fall victim to browser popup blockers, unfortunately, there is very little we can do to help this.

The login dialog will also return one of two response types, either a successful “auth” object, or a failure object.

The login dialog offers a number of different features including opening a login form, a registration form, or using Facebook login.

The simplest implementation would be as follows.

If you wish to trigger the registration form instead of the sign in form you can do the following.

To automatically reload the originating page, to log the user into site and game, pass an additional object to it, similar to this.

If you wish to trigger a Facebook sign in you can do the following.

Full examples can be found on GitHub.