The redirect URI allows a server to act on behalf of a user. After a user login, a code variable is exchanged for a long lived token by the application server. More details about Oauth2 API can be found the Getting a Token page.

<a href="#" id="idnet-connect">
  Connect with Y8 Account to play

<script type="text/javascript">
window.idAsyncInit = function() {
    // When SDK is ready and when id.init event is triggered (all initialization processes are done i.e. ID.init called)
    // We register an event with jQuery
    // on click on the connect link it will open the Y8 Account authentication modal window
    ID.Event.subscribe('id.init', function(){
        $('#idnet-connect').on('click', function(){

    // init the ID JS SDK
        appId: 'YOUR_APP_ID', // App ID from the app dashboard
        status: true, // Force update the Y8 Account login status
        responseType: 'code', // 'token' by default
        redirectUri: '' // override the redirect_uri

(function(d, s, id){
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement(s); = id;
    js.src =  document.location.protocol == 'https:' ? "" : "";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'id-jssdk'));

Initialization parameters

The default status setting of false will improve page load times. It will check for cached data before calling the login API.

By setting status to true, the SDK will refresh the user authentication information instead of retreiving previously loaded data.

Capuring the Oauth response code

PHP example
Nodejs example