How to login with access token and refresh token

I’m trying to get user info from existing valid token

Here is my init call on js adapter.

keycloak.init({
token: access_token,
refreshToken: refresh_token,
checkLoginIframe: false
}).success((authenticated) => {
console.log(“Success”)
}).error((err) => {
console.log(err)
})

Prints error-> undefined

Does init function need anything else to be successfully authenticated?
Realm and auth server endpoint are correct.

If I add onload: ‘login-required’
It shows login screen which I dont want.

You can use the userinfo_endpoint.

See: Getting started with Keycloak

Thats a great suggestion but then it would loose all the javascript adapter features like keycloak.logout() or onTokenExpire. I was hoping for init to work like this but it isnt.