I'm trying to use the keycloak js adapter, by using tokens given by Keycloak. https://www.npmjs.com/package/@react-keycloak/web Something like this:
import { ReactKeycloakProvider } from '@react-keycloak/web';
import keycloakClient from './keycloak';
import AuthenticatedApp from './AuthenticatedApp';
const keycloakInitOptions = {
onLoad: 'check-sso',
// enableLogging: true,
token: token,
refreshToken: refreshToken,
idToken: idToken,
checkLoginIframe: false,
// promiseType: legacy
};
function App() {
return (
<ReactKeycloakProvider
authClient={keycloakClient}
initOptions={keycloakInitOptions}>
<AuthenticatedApp />
</ReactKeycloakProvider>
);
}
export default App;
But it doesn't seem to use the tokens. If I look at the keycloak object, the tokens are just undefined. Maybe I have misunderstood how to use it? Maybe it's something with the react wrapper that changes how it used. I looked at this https://keycloak.discourse.group/t/automatic-login-to-javascript-client-adapter-with-inital-access-and-refresh-token/1331 and I seem to be doing the same. I have tried without the access token, and without the refresh token to see if it made a difference or not. I tried the promiseType=legacy, but same result.