Attempting to init keycloak-js adapter with tokens fails

I’m trying to initialize my keycloak-js adapter in my code with tokens I get from an external resource.
I see when debugging it does work but some code in the adapter calls clearToken afterwards and resets my tokens.

My code does:

keycloakInstance.init({
     enableLogging: true,
     token: data.access_token,
     refreshToken: data.refresh_token
})

I can see in debug that the function messageCallback defined under setupCheckLoginIframe does this check:

if (event.data != 'unchanged') {
   kc.clearToken();
}

And that’s what resets the token I’ve set using the init function.

Is there something to do about it? is this intentional or a bug?