Login

You can log the user in using MC.login(). This function will trigger a dialog box (below) for the user where they can log in, and on a successful login will return the user’s access token.

Login Dialog

Request

Parameter Type Description
callback function<Login Response> Callback methods that receives a Login Response

Example

MC.login(function(response){
  document.write(response.auth.access_token);
});

You can also access the timestamp of when the token was generated and when it expires via response.auth.generated_at and response.auth.expires_at.

The login methods needs to be executed as the result of a click event, otherwise the browser might block the login dialog.

Logout

Trigger the user logout

Request

Parameter Type Description
callback function Called on method completion

Example

MC.logout()

Get Login Status

MC.getLoginStatus() allows you to determine if a user is logged in in Miniclip.com.

There are two possible status:

  • MC.LOGIN_STATUS.CONNECTED: The user is logged in Miniclip.com (“connected”)
  • MC.LOGIN_STATUS.UNKNOWN` (“unknown”)

Request

Parameter Type Description
callback function<Login Status Response>  

Example

MC.getLoginStatus(function(response){
    if (response.status == MC.LOGIN_STATUS.CONNECTED)
        console.log("The user is connected.");
    else
        console.log("The user probably isn't connected.");
})

Get Auth Response

MC.getAuthResponse() is a synchronous getter for the current Auth Object.

Even if the auth object is available, this method does not check the access token validaty. To be sure the user is logged in use getLoginStatus method.

Response

Type Description
Auth Object Current auth object if available, ```null`` otherwise

Resources

Login Response Object
Field Type Description
auth Auth Object  
Auth Object
Field Type Description
access_token string  
generated_at float Timestamp when token was generated
nickname string User’s nickname
user_id integer User’s id
Login Status Object
Option Value Description
CONNECTED “connected” The user is logged in Miniclip.com
UNKNOWN “unknown” Probably the user isn’t logged in
Login Status Response Object
Field Type Description
status string Login Status