Version: v2.0

Warning: Before you continue make sure the webshop has implemented the WebshopLogin buttons. For more information on how to implement these buttons click here.

When the customer clicks on the WebshopLogin-loginbutton the customer will be prompted to authorize the exchange of personal information between WebshopLogin and the current shop. If the customer successfully authorizes the exchange of personal information and completes the login process in the modal the webshop will be authorized to get the users data. The event “getAccesstokenResponse” will be fired in Javascript. If you add an eventlistener to this event you will be able to retrieve the accesstoken and login the user.
After retrieving the accesstoken you can get the userdata and check if a customer with that webshoplogin-id already exists. If a user with that id already exists you can login and synchronise the account that belongs to the customer. Otherwise you should check if user.verified is true and if it is, create a new account.

Note: make sure you save the webshoplogin-id combined with the customer-id from the webshop. Such that you can login a customer by their webshoplogin-id.
    document.addEventListener("getAccesstokenResponse", function(event) {
    }, false);