Reputation: 123
I'm just upgraded from Keycloak 22 to 25;
I can't get the userinfo although I tried all the suggestions:
Can you please assist:
I'm using React Native as the frontend app. To fetch the user info, I'm using this method:
const getUserInfo = await fetchUserInfoAsync(tokenResult, discoveryResult!);
The error I get from the keycloak's logs is:
2024-07-30 22:52:33 2024-07-31 05:52:33,095 WARN [org.keycloak.events] (executor-thread-4) type="USER_INFO_REQUEST_ERROR", realmId="a8f79f64-1833-4832-9b3a-079763cb6fc3", realmName="myrealm", clientId="null", userId="null", ipAddress="172.17.0.1", error="invalid_token", reason="Failed to read access token from JWT", auth_method="validate_access_token"
The error I get from the React Native app is at line 42 in Fetch.js:
// Fix a problem with React Native `URL` causing a trailing slash to be added.
const correctedUrl = url.toString().replace(/\/$/, '');
const response = await fetch(correctedUrl, request); ---> (error here: 401 Unauthorized)
const contentType = response.headers.get('content-type');
if (isJsonDataType || contentType?.includes('application/json')) {
return response.json();
}
Can you please assist. I've spent two days trying to figure this out.
Thanks
Upvotes: 0
Views: 457